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())); }
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(); }