1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 #include "insertTable.h"
8
9 #include "commonstrings.h"
10 #include "iconmanager.h"
11
InsertTable(QWidget * parent,int maxRow,int maxCol)12 InsertTable::InsertTable( QWidget* parent, int maxRow, int maxCol ) : QDialog( parent )
13
14 {
15 setWindowTitle( tr( "Insert Table" ) );
16 setWindowIcon(IconManager::instance().loadIcon("AppIcon.png"));
17 setModal(true);
18 InsertTableLayout = new QVBoxLayout( this );
19 InsertTableLayout->setContentsMargins(9, 9, 9, 9);
20 InsertTableLayout->setSpacing(6);
21 layout2 = new QGridLayout();
22 layout2->setContentsMargins(0, 0, 0, 0);
23 layout2->setSpacing(6);
24 Cols = new QSpinBox(this);
25 Cols->setRange(1, maxCol);
26 Cols->setValue(1);
27 layout2->addWidget( Cols, 1, 1 );
28 Text1 = new QLabel( tr( "Number of rows:" ), this);
29 Text2 = new QLabel( tr( "Number of columns:" ), this);
30 layout2->addWidget( Text1, 0, 0 );
31 layout2->addWidget( Text2, 1, 0 );
32 Rows = new QSpinBox(this);
33 Rows->setRange(1, maxRow);
34 Rows->setValue(1);
35 layout2->addWidget( Rows, 0, 1 );
36 InsertTableLayout->addLayout( layout2 );
37 layout1 = new QHBoxLayout();
38 layout1->setSpacing(6);
39 okButton = new QPushButton( CommonStrings::tr_OK, this);
40 cancelButton = new QPushButton( CommonStrings::tr_Cancel, this);
41 okButton->setDefault( true );
42 layout1->addWidget( okButton );
43 layout1->addWidget( cancelButton );
44 InsertTableLayout->addLayout( layout1 );
45 resize( QSize(200, 100).expandedTo(minimumSizeHint()) );
46
47 setTabOrder ( Rows, Cols );
48 setTabOrder ( Cols, okButton );
49 setTabOrder ( okButton, cancelButton);
50 setTabOrder ( cancelButton, Rows );
51 Rows->setFocus();
52 // signals and slots connections
53 connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
54 connect( cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) );
55 }
56
57