MultipleWindowWidget::MultipleWindowWidget(const QString &name, QWidget *parent) : PositionMemoryWidget(name, parent) { mAddTabButton = new QPushButton("+"); mAddTabButton->setWhatsThis("Add a new tag to the dialog."); mRemoveTabButton = new QPushButton("-"); mRemoveTabButton->setWhatsThis("Removes a tab from the dialog."); mRemoveTabButton->setEnabled(false); mAddTabButton->setFixedWidth(30); mRemoveTabButton->setFixedWidth(30); mTabWidget = new QTabWidget(); QWidget *mainWidget = centralWidget(); QVBoxLayout *mainLayout = new QVBoxLayout(mainWidget); mainWidget->setLayout(mainLayout); QHBoxLayout *upperLayout = new QHBoxLayout(); upperLayout->setMargin(1); mainLayout->addLayout(upperLayout); mainLayout->setAlignment(upperLayout, Qt::AlignTop); upperLayout->addStretch(1000); upperLayout->addWidget(mAddTabButton); upperLayout->addWidget(mRemoveTabButton); mainLayout->addWidget(mTabWidget); connect(mAddTabButton, SIGNAL(clicked()), this, SLOT(addButtonPressed())); connect(mRemoveTabButton, SIGNAL(clicked()), this, SLOT(removeButtonPressed())); }
int main(int argc, char *argv[]) { QApplication a(argc, argv); InterfaceController c; MainWindow w; c.window=&w; QObject::connect(&w,SIGNAL(addButtonPressed()),&c,SLOT(callAddFilmDialog())); QObject::connect(&w,SIGNAL(getInfo(QString)),&c,SLOT(callInfoDialog(QString))); QObject::connect(&c,SIGNAL(addFilm(Film)),&w,SLOT(addFilm(Film))); QObject::connect(&w,SIGNAL(editButtonPressed(QString)),&c,SLOT(callEditFilmDialog(QString))); QObject::connect(&c,SIGNAL(editFilm(Film)),&w,SLOT(editFilm(Film))); QObject::connect(&w,SIGNAL(deleteButtonPressed(QString)),&c,SLOT(callDeleteFilmDialog(QString))); c.initTable(); w.show(); return a.exec(); }
DbTab::DbTab(QWidget *parent) : QWidget(parent) { // tables[0]=std::make_pair("Снимки", DatabaseView::getInstance().snapshotsTable()); // tables[1]=std::make_pair("Сцены", DatabaseView::getInstance().scenesTable()); // tables[2]=std::make_pair("Описания объектов", DatabaseView::getInstance().descriptionsTable()); // tables[3]=std::make_pair("Объекты", DatabaseView::getInstance().objectsTable()); // tables[4]=std::make_pair("Карты",DatabaseView::getInstance().descriptionsTable()); tableBox = new QComboBox(); mainLayout = new QGridLayout(); mainLayout->addWidget(tableBox,0,4,1,2); for(std::map<int,std::pair<QString,QTableWidget*> >::iterator it=tables.begin(); it!=tables.end(); it++) { tableBox->addItem(it->second.first); mainLayout->addWidget(it->second.second,1,1,5,5); it->second.second->hide(); } connect(tableBox,SIGNAL(currentIndexChanged(int)),SLOT(tableChanged(int))); table=tables[0].second; table->show(); addButton=new QPushButton("Добавить"); connect(addButton,SIGNAL(clicked()),SLOT(addButtonPressed())); mainLayout->addWidget(addButton,6,2,1,1); addButton->hide(); changeButton=new QPushButton("Изменить"); connect(changeButton,SIGNAL(clicked()),SLOT(changeButtonPressed())); mainLayout->addWidget(changeButton,6,3,1,1); changeButton->hide(); QPushButton *reloadButton=new QPushButton("Обновить"); connect(reloadButton,SIGNAL(clicked()),SLOT(reloadTable())); mainLayout->addWidget(reloadButton,6,4,1,1); QPushButton *delButton=new QPushButton("Удалить"); connect(delButton,SIGNAL(clicked()),SLOT(delButtonPressed())); mainLayout->addWidget(delButton,6,5,1,1); setLayout(mainLayout); }
ossimQtPluginsDialog::ossimQtPluginsDialog(QWidget* parent) : QDialog(parent, "ossimQtPluginsDialog", Qt::WDestructiveClose), thePluginList(0), theDescription(0), theAddButton(0), theRemoveButton(0), theCloseButton(0) { setCaption("Plugin Dialog"); // Main box to hold everything. Parented to this dialog box... QVBoxLayout* mainLayout = new QVBoxLayout(this); // Row one: QGroupBox* row1GroupBox = new QGroupBox(); // Row one: 2 columns horizontal. QHBoxLayout* row1Layout = new QHBoxLayout(); // Row one, Column one, a list of plugins. QGroupBox* pluginListGroupBox = new QGroupBox(QString("Plugins")); QVBoxLayout* pluginListLayout = new QVBoxLayout(); // plugin list pointer stored by class. thePluginList = new QListWidget(); // Parent list to layout. pluginListLayout->addWidget(thePluginList); // Parent layout to group box. pluginListGroupBox->setLayout(pluginListLayout); // Parent group box to row one layout. row1Layout->addWidget(pluginListGroupBox); // Row one , column two, selected plugin description. QGroupBox* descriptionGroupBox = new QGroupBox(QString("Description")); QVBoxLayout* descriptionLayout = new QVBoxLayout(); // plugin description pointer stored by class. theDescription = new QTextEdit(); // Only we can mess with text. theDescription->setReadOnly(true); // Parent text edit to layout. descriptionLayout->addWidget(theDescription); // Parent layout to group box. descriptionGroupBox->setLayout(descriptionLayout); // Parent group box to row one layout. row1Layout->addWidget(descriptionGroupBox); // Parent the row1Layout to the row1GroupBox. row1GroupBox->setLayout(row1Layout); // Parent row one group box to main layout mainLayout->addWidget(row1GroupBox); //--- // End of row one. //--- //--- // Row two: //--- QGroupBox* row2GroupBox = new QGroupBox(); // Row two: horizontal buttonw. QHBoxLayout* row2Layout = new QHBoxLayout(); // Row two, column one, add button. theAddButton = new QPushButton("Add"); row2Layout->addWidget(theAddButton); // Row two, column two, remove button. theRemoveButton = new QPushButton("Remove"); row2Layout->addWidget(theRemoveButton); // Row two, column three, close button. theCloseButton = new QPushButton("Close"); row2Layout->addWidget(theCloseButton); // Parent the row2Layout to the row2GroupBox. row2GroupBox->setLayout(row2Layout); // Parent row two group box to main layout mainLayout->addWidget(row2GroupBox); //--- // End of row two. //--- //--- // Connect all the signals to slots... //--- connect( thePluginList, SIGNAL ( itemSelectionChanged () ), this, SLOT ( pluginSelectionChanged() ) ); connect( theAddButton, SIGNAL ( pressed() ), this, SLOT ( addButtonPressed() ) ); connect( theRemoveButton, SIGNAL ( pressed() ), this, SLOT ( removeButtonPressed() ) ); connect( theCloseButton, SIGNAL ( pressed() ), this, SLOT ( closeButtonPressed() ) ); //--- // Set up the plugin list and description. //--- updateDialog(); }
MultipleParameterWindowWidget::MultipleParameterWindowWidget(const QString &name, QWidget *parent) : MultipleWindowWidget(name, parent), mCounter(1) { setWindowTitle("Object Properties"); resize(200, 500); addButtonPressed(); connect(this, SIGNAL(initPhaseCompleted()), this, SLOT(handleInitPhase())); connect(this, SIGNAL(shutDownPhaseStarted()), this, SLOT(handleShutDownPhase())); QMenuBar *localMenuBar = menuBar(); QMenu *fileMenu = localMenuBar->addMenu("File"); QAction *saveSinglePanelsAction = fileMenu->addAction("Save Panel"); connect(saveSinglePanelsAction, SIGNAL(triggered()), this, SLOT(saveSinglePanelToFile())); QAction *loadSinglePanelsAction = fileMenu->addAction("Load Panel"); connect(loadSinglePanelsAction, SIGNAL(triggered()), this, SLOT(loadSinglePanelFromFile())); fileMenu->addSeparator(); QAction *saveAllPanelsAction = fileMenu->addAction("Save All Panels"); connect(saveAllPanelsAction, SIGNAL(triggered()), this, SLOT(saveAllPanelsToFile())); QAction *loadAllPanelsAction = fileMenu->addAction("Load All Panels"); connect(loadAllPanelsAction, SIGNAL(triggered()), this, SLOT(loadAllPanelsFromFile())); QMenu *editMenu = localMenuBar->addMenu("Edit"); QAction *selectSingleAction = editMenu->addAction("Select Panel"); connect(selectSingleAction, SIGNAL(triggered()), this, SLOT(selectSinglePanel())); QAction *applySingleAction = editMenu->addAction("Apply Panel"); connect(applySingleAction, SIGNAL(triggered()), this, SLOT(applySinglePanel())); QAction *clearSingleAction = editMenu->addAction("Clear Panel"); connect(clearSingleAction, SIGNAL(triggered()), this, SLOT(clearSinglePanel())); editMenu->addSeparator(); QAction *applyAllAction = editMenu->addAction("Apply All in All Panels"); connect(applyAllAction, SIGNAL(triggered()), this, SLOT(applyAllProperties())); QAction *applyAndSelectAllAction = editMenu->addAction("Apply and Select All in All Panels"); connect(applyAndSelectAllAction, SIGNAL(triggered()), this, SLOT(applyAndSelectAllProperties())); QAction *selectAllAction = editMenu->addAction("Select All in All Panels"); connect(selectAllAction, SIGNAL(triggered()), this, SLOT(selectAllProperties())); QAction *deselectAllAction = editMenu->addAction("Deselect All in All Panels"); connect(deselectAllAction, SIGNAL(triggered()), this, SLOT(deselectAllProperties())); editMenu->addSeparator(); QAction *copyToAllValuesAction = editMenu->addAction("Copy First To All"); connect(copyToAllValuesAction, SIGNAL(triggered()), this, SLOT(copyFirstValueToAllOtherValues())); QAction *setInitForAllValuesAction = editMenu->addAction("Set Init To All"); connect(setInitForAllValuesAction, SIGNAL(triggered()), this, SLOT(setInitToAllValues())); QMenu *plotterMenu = localMenuBar->addMenu("Plotter"); QAction *activateHistoryPlotter = plotterMenu->addAction("History Plotter"); connect(activateHistoryPlotter, SIGNAL(triggered()), this, SLOT(activateHistoryPlotter())); //QAction *activateXYPlotter = plotterMenu->addAction("X/Y Plotter"); //connect(activateXYPlotter, SIGNAL(triggered()), // this, SLOT(activateXYPlotter())); QMenu *helpMenu = localMenuBar->addMenu("Help"); helpMenu->addAction(QWhatsThis::createAction()); }