void PageContainer::createUI() { m_pageStack = new QStackedLayout; m_filter = new QLineEdit; m_pageList = new PageView; m_header = new QLabel(); m_iconHeader = new IconLabel(this, QIcon(), QSize(24, 24)); QFont headerLabelFont = m_header->font(); headerLabelFont.setBold(true); const int pointSize = headerLabelFont.pointSize(); if (pointSize > 0) headerLabelFont.setPointSize(pointSize + 2); m_header->setFont(headerLabelFont); QHBoxLayout *headerHLayout = new QHBoxLayout; const int leftMargin = MMC->style()->pixelMetric(QStyle::PM_LayoutLeftMargin); headerHLayout->addSpacerItem( new QSpacerItem(leftMargin, 0, QSizePolicy::Fixed, QSizePolicy::Ignored)); headerHLayout->addWidget(m_header); headerHLayout->addSpacerItem( new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Ignored)); headerHLayout->addWidget(m_iconHeader); m_pageStack->setMargin(0); m_pageStack->addWidget(new QWidget(this)); m_layout = new QGridLayout; m_layout->addLayout(headerHLayout, 0, 1, 1, 1); m_layout->addWidget(m_pageList, 0, 0, 2, 1); m_layout->addLayout(m_pageStack, 1, 1, 1, 1); m_layout->setColumnStretch(1, 4); setLayout(m_layout); }
FakePluginWidget::FakePluginWidget (uint id, const QUrl& url, const QString& mimeType, QWidget* parent) :QWidget(parent) ,m_swapping(false) ,m_updateScrollPosition(false) ,m_mimeType(mimeType) ,m_id(id) { QHBoxLayout* horizontalLayout = new QHBoxLayout; setLayout(horizontalLayout); QSpacerItem* horizontalSpacer = new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); horizontalLayout->addSpacerItem(horizontalSpacer); QPushButton* startPluginButton = new QPushButton(this); startPluginButton->setText(i18n("Start Plugin")); horizontalLayout->addWidget(startPluginButton); horizontalSpacer = new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); horizontalLayout->addSpacerItem(horizontalSpacer); setContextMenuPolicy(Qt::CustomContextMenu); connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint))); connect(startPluginButton, SIGNAL(clicked()), this, SLOT(load())); setToolTip(url.toString()); }
void Widget::display() { delete layout(); QSpacerItem *space1 = new QSpacerItem(100,10); QSpacerItem *space2 = new QSpacerItem(100,10); QSpacerItem *space3 = new QSpacerItem(10,10); QHBoxLayout *hlayout = new QHBoxLayout; hlayout->addSpacerItem(space1); hlayout->addWidget(integral); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(numerator); if(this->isVisibleDenominator){ QPixmap lineP(max(lineSizePixels((QString)numerator->text()),lineSizePixels((QString)denominator->text())),2); QPainter paint; paint.begin(&lineP); paint.setBrush(QBrush(Qt::black)); paint.eraseRect(0,0,1000,1000); paint.drawRect(0,0,1000,1000); paint.end(); line->setPixmap(lineP); layout->addWidget(line); layout->addWidget(denominator); } hlayout->addLayout(layout); hlayout->addSpacerItem(space3); hlayout->addWidget(diff); hlayout->addSpacerItem(space2); QVBoxLayout *vlayout = new QVBoxLayout; vlayout->addLayout(hlayout); vlayout->addWidget(answer); setLayout(vlayout); }
YbTabWidget::YbTabWidget(YbInformation *leftWidget, YbConsole *rightWidget, QWidget *parent) : QWidget(parent) { leftTabButton = new YbTabButton(tr("信息"), true); rightTabButton = new YbTabButton(tr("控制台"), false); stackedWidget = new YbStackedWidget; m_leftWidget = leftWidget; m_rightWidget = rightWidget; if(m_leftWidget != NULL){ stackedWidget->addWidget(m_leftWidget); stackedWidget->setCurrentWidget(m_leftWidget); } if(m_rightWidget != NULL){ stackedWidget->addWidget(m_rightWidget); } connect(leftTabButton, SIGNAL(clicked(bool)), this, SLOT(leftTabButtonChecked(bool))); connect(rightTabButton, SIGNAL(clicked(bool)), this, SLOT(rightTabButtonChecked(bool))); QHBoxLayout *tabButtonLayout = new QHBoxLayout; tabButtonLayout->setSpacing(0); tabButtonLayout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum)); tabButtonLayout->addWidget(leftTabButton); #ifdef Q_OS_MAC tabButtonLayout->addSpacing(10); #endif tabButtonLayout->addWidget(rightTabButton); tabButtonLayout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum)); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->setMargin(0); mainLayout->addLayout(tabButtonLayout); mainLayout->addWidget(stackedWidget); setLayout(mainLayout); }
void SingleConnectorInfoWidget::toStandardMode() { hide(); setInEditionMode(false); hideIfNeeded(m_nameEditContainer); hideIfNeeded(m_descEditContainer); hideIfNeeded(m_acceptButton); hideIfNeeded(m_cancelButton); QHBoxLayout *hbLayout = new QHBoxLayout(); hbLayout->addWidget(m_type); hbLayout->addSpacerItem(new QSpacerItem(10,0)); hbLayout->addWidget(m_nameLabel); m_nameLabel->show(); hbLayout->addWidget(m_nameDescSeparator); m_nameDescSeparator->show(); hbLayout->addWidget(m_descLabel); m_descLabel->show(); hbLayout->addSpacerItem(new QSpacerItem(0,0,QSizePolicy::Expanding)); hbLayout->addWidget(m_removeButton); QVBoxLayout *layout = (QVBoxLayout*)this->layout(); layout->addLayout(hbLayout); setFixedHeight(SingleConnectorHeight); setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred); updateGeometry(); show(); setFocus(); }
void FileBrowserDialog::createTitleBar() { header_ = new QWidget; header_->setObjectName("mHeader"); QHBoxLayout *layout = new QHBoxLayout; layout->setContentsMargins(1, 1, 1, 1); layout->setSpacing(0); header_->setLayout(layout); QSpacerItem *spacer1 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); layout->addSpacerItem(spacer1); brand_label_ = new QLabel(windowTitle()); brand_label_->setObjectName("mBrand"); layout->addWidget(brand_label_); QSpacerItem *spacer2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); layout->addSpacerItem(spacer2); minimize_button_ = new QPushButton; minimize_button_->setObjectName("mMinimizeBtn"); minimize_button_->setToolTip(tr("Minimize")); minimize_button_->setIcon(awesome->icon(icon_minus, QColor("#808081"))); layout->addWidget(minimize_button_); connect(minimize_button_, SIGNAL(clicked()), this, SLOT(showMinimized())); close_button_ = new QPushButton; close_button_->setObjectName("mCloseBtn"); close_button_->setToolTip(tr("Close")); close_button_->setIcon(awesome->icon(icon_remove, QColor("#808081"))); layout->addWidget(close_button_); connect(close_button_, SIGNAL(clicked()), this, SLOT(close())); header_->installEventFilter(this); }
HistoryWidget::HistoryWidget( const source_ptr& source, QWidget* parent ) : FlexibleView( parent, m_header = new QWidget() ) { m_header->setMaximumHeight( 160 ); /* QCalendarWidget* m_calendarFrom = new QCalendarWidget(); QCalendarWidget* m_calendarTo = new QCalendarWidget(); m_calendarFrom->setGridVisible( false ); m_calendarTo->setGridVisible( false );*/ m_calendarFrom = new QDateEdit( QDate::currentDate() ); m_calendarTo = new QDateEdit( QDate::currentDate() ); m_calendarFrom->setDisplayFormat( "yyyy MMMM dd" ); m_calendarTo->setDisplayFormat( "yyyy MMMM dd" ); // setting an empty style-sheet prevents the QDateEdits from adopting their parent's QPalette QString calSheet = QString( "QDateEdit { }" ).arg( TomahawkStyle::PAGE_BACKGROUND.name() ); m_calendarFrom->setStyleSheet( calSheet ); m_calendarTo->setStyleSheet( calSheet ); QPalette pal = m_header->palette(); pal.setColor( QPalette::Foreground, Qt::white ); pal.setColor( QPalette::Text, Qt::white ); pal.setBrush( backgroundRole(), TomahawkStyle::PAGE_BACKGROUND ); m_header->setPalette( pal ); m_header->setAutoFillBackground( true ); QHBoxLayout* layout = new QHBoxLayout( m_header ); layout->addSpacerItem( new QSpacerItem( 1, 0, QSizePolicy::MinimumExpanding, QSizePolicy::Minimum ) ); layout->addWidget( new QLabel( tr( "From:" ) ) ); layout->addWidget( m_calendarFrom ); layout->addSpacerItem( new QSpacerItem( 16, 0, QSizePolicy::Fixed, QSizePolicy::Minimum ) ); layout->addWidget( new QLabel( tr( "To:" ) ) ); layout->addWidget( m_calendarTo ); layout->addSpacerItem( new QSpacerItem( 1, 0, QSizePolicy::MinimumExpanding, QSizePolicy::Minimum ) ); m_header->setLayout( layout ); setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::RecentlyPlayed ) ); m_model = new RecentlyPlayedModel( this ); m_model->setTitle( tr( "Recently Played Tracks" ) ); if ( source->isLocal() ) m_model->setDescription( tr( "Your recently played tracks" ) ); else m_model->setDescription( tr( "%1's recently played tracks" ).arg( source->friendlyName() ) ); PlaylistLargeItemDelegate* del = new PlaylistLargeItemDelegate( PlaylistLargeItemDelegate::RecentlyPlayed, trackView(), trackView()->proxyModel() ); trackView()->setItemDelegate( del ); setPlayableModel( m_model ); setEmptyTip( tr( "Sorry, we could not find any recent plays!" ) ); m_model->setSource( source ); setGuid( QString( "recentplays/%1" ).arg( source->nodeId() ) ); /* connect( m_calendarFrom, SIGNAL( clicked( QDate ) ), SLOT( onDateClicked( QDate ) ) ); connect( m_calendarTo, SIGNAL( clicked( QDate ) ), SLOT( onDateClicked( QDate ) ) );*/ connect( m_calendarFrom, SIGNAL( dateChanged( QDate ) ), SLOT( onDateClicked( QDate ) ) ); connect( m_calendarTo, SIGNAL( dateChanged( QDate ) ), SLOT( onDateClicked( QDate ) ) ); }
void SingleConnectorInfoWidget::toEditionMode() { hide(); setInEditionMode(true); hideIfNeeded(m_nameLabel); hideIfNeeded(m_nameDescSeparator); hideIfNeeded(m_descLabel); createInputs(); // first row QHBoxLayout *firstRowLayout = new QHBoxLayout(); firstRowLayout->addWidget(m_type); firstRowLayout->addSpacerItem(new QSpacerItem(10,0)); firstRowLayout->addWidget(m_nameEditContainer); firstRowLayout->addSpacerItem(new QSpacerItem(0,0,QSizePolicy::Expanding)); firstRowLayout->addWidget(m_removeButton); m_nameEditContainer->show(); // second row m_descEditContainer->show(); // third row if(!m_acceptButton) { m_acceptButton = new QPushButton(QObject::tr("Accept"),this); connect(m_acceptButton,SIGNAL(clicked()),this,SLOT(editionCompleted())); } m_acceptButton->show(); if(!m_cancelButton) { m_cancelButton = new QPushButton(QObject::tr("Cancel"),this); connect(m_cancelButton,SIGNAL(clicked()),this,SLOT(editionCanceled())); } m_cancelButton->show(); QHBoxLayout *thirdRowLayout = new QHBoxLayout(); thirdRowLayout->addSpacerItem(new QSpacerItem(0,0,QSizePolicy::Expanding)); thirdRowLayout->addWidget(m_acceptButton); thirdRowLayout->addWidget(m_cancelButton); QVBoxLayout *layout = (QVBoxLayout*)this->layout(); layout->addLayout(firstRowLayout); layout->addWidget(m_descEditContainer); layout->addLayout(thirdRowLayout); setFixedHeight(SingleConnectorHeight*4); setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); updateGeometry(); show(); setFocus(); emit editionStarted(); }
PartsEditorViewsWidget::PartsEditorViewsWidget(SketchModel *sketchModel, WaitPushUndoStack *undoStack, ConnectorsInfoWidget* info, QWidget *parent, ItemBase * fromItem) : QFrame(parent) { init(); m_showTerminalPointsCheckBox = new QCheckBox(this); m_showTerminalPointsCheckBox->setText(tr("Show Anchor Points")); connect(m_showTerminalPointsCheckBox, SIGNAL(stateChanged(int)), this, SLOT(showHideTerminalPoints(int))); m_breadView = createViewImageWidget(sketchModel, undoStack, ViewLayer::BreadboardView, "breadboard_icon.png", EmptyBreadViewText, info, ViewLayer::Breadboard, fromItem); m_schemView = createViewImageWidget(sketchModel, undoStack, ViewLayer::SchematicView, "schematic_icon.png", EmptySchemViewText, info, ViewLayer::Schematic, fromItem); m_pcbView = createViewImageWidget(sketchModel, undoStack, ViewLayer::PCBView, "pcb_icon.png", EmptyPcbViewText, info, ViewLayer::Copper0, fromItem); m_breadView->setViewLayerIDs(ViewLayer::Breadboard, ViewLayer::BreadboardWire, ViewLayer::Breadboard, ViewLayer::BreadboardRuler, ViewLayer::BreadboardNote); m_schemView->setViewLayerIDs(ViewLayer::Schematic, ViewLayer::SchematicWire, ViewLayer::Schematic, ViewLayer::SchematicRuler, ViewLayer::SchematicNote); m_pcbView->setViewLayerIDs(ViewLayer::Schematic, ViewLayer::SchematicWire, ViewLayer::Schematic, ViewLayer::SchematicRuler, ViewLayer::PcbNote); connectPair(m_breadView,m_schemView); connectPair(m_schemView,m_pcbView); connectPair(m_pcbView,m_breadView); connectToThis(m_breadView); connectToThis(m_schemView); connectToThis(m_pcbView); m_viewsContainter = new QSplitter(this); m_viewsContainter->addWidget(addZoomControlsAndBrowseButton(m_breadView)); m_viewsContainter->addWidget(addZoomControlsAndBrowseButton(m_schemView)); m_viewsContainter->addWidget(addZoomControlsAndBrowseButton(m_pcbView)); m_viewsContainter->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); m_guidelines = new QLabel(tr("Please refer to the <a style='color: #52182C' href='http://fritzing.org/learning/tutorials/creating-custom-parts/'>guidelines</a> before modifying or creating parts"), this); m_guidelines->setOpenExternalLinks(true); m_guidelines->setObjectName("guidelinesLabel"); QHBoxLayout *labelLayout = new QHBoxLayout(); labelLayout->addSpacerItem(new QSpacerItem(0,0,QSizePolicy::MinimumExpanding,QSizePolicy::Fixed)); labelLayout->addWidget(m_guidelines); labelLayout->addSpacerItem(new QSpacerItem(0,0,QSizePolicy::MinimumExpanding,QSizePolicy::Fixed)); QFrame *toolsAndInfoContainer = new QFrame(this); QHBoxLayout *layout2 = new QHBoxLayout(toolsAndInfoContainer); layout2->addLayout(labelLayout); layout2->addWidget(m_showTerminalPointsCheckBox); layout2->setMargin(1); layout2->setSpacing(1); QVBoxLayout *lo = new QVBoxLayout(this); lo->addWidget(m_viewsContainter); lo->addWidget(toolsAndInfoContainer); lo->setMargin(3); lo->setSpacing(1); this->resize(width(),220); //this->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed); }
QWidget *S60DeployConfigurationWidget::createCommunicationChannel() { m_serialPortsCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents); connect(m_serialPortsCombo, SIGNAL(activated(int)), this, SLOT(setSerialPort(int))); connect(m_serialRadioButton, SIGNAL(clicked()), this, SLOT(updateCommunicationChannel())); connect(m_wlanRadioButton, SIGNAL(clicked()), this, SLOT(updateCommunicationChannel())); connect(m_ipAddress, SIGNAL(validAddressChanged(QString)), this, SLOT(updateWlanAddress(QString))); connect(m_ipAddress, SIGNAL(invalidAddressChanged()), this, SLOT(cleanWlanAddress())); QHBoxLayout *serialPortHBoxLayout = new QHBoxLayout; serialPortHBoxLayout->addWidget(new QLabel(tr("Serial port:"))); serialPortHBoxLayout->addWidget(m_serialPortsCombo); serialPortHBoxLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Ignored)); #if !defined(Q_OS_WIN) && !defined(Q_OS_MACX) // Update device list: only needed on linux. QToolButton *updateSerialDevicesButton(new QToolButton); updateSerialDevicesButton->setIcon(qApp->style()->standardIcon(QStyle::SP_BrowserReload)); connect(updateSerialDevicesButton, SIGNAL(clicked()), SymbianUtils::SymbianDeviceManager::instance(), SLOT(update())); serialPortHBoxLayout->addWidget(updateSerialDevicesButton); #endif QGroupBox *communicationChannelGroupBox = new QGroupBox(tr("Communication Channel")); QGridLayout *communicationChannelGridLayout = new QGridLayout; communicationChannelGridLayout->addWidget(m_serialRadioButton, 0, 0); communicationChannelGridLayout->addWidget(m_wlanRadioButton, 1, 0); m_ipAddress->setMinimumWidth(30); m_ipAddress->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Ignored); if(!m_deployConfiguration->deviceAddress().isEmpty()) m_ipAddress->setText(QString("%1:%2") .arg(m_deployConfiguration->deviceAddress()) .arg(m_deployConfiguration->devicePort())); QHBoxLayout *wlanChannelLayout = new QHBoxLayout(); wlanChannelLayout->addWidget(new QLabel(tr("Address:"))); wlanChannelLayout->addWidget(m_ipAddress); wlanChannelLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Ignored)); communicationChannelGridLayout->addLayout(serialPortHBoxLayout, 0, 1); communicationChannelGridLayout->addLayout(wlanChannelLayout, 1, 1); communicationChannelGroupBox->setLayout(communicationChannelGridLayout); updateCommunicationChannelUi(); return communicationChannelGroupBox; }
VolumeControlPanel::VolumeControlPanel(QWidget *parent) : QWidget(parent) { setAttribute(Qt::WA_StyledBackground, true); setFixedWidth(108); muteButton = new MyButton(this); maxButton = new MyButton(this); playlistButton = new MyButton(this); equalizerButton = new MyButton(this); fullscreenButton = new MyButton(this); playlistButton->setCheckable(true); equalizerButton->setCheckable(true); fullscreenButton->setCheckable(true); volumeBar = new PanelSeeker(this); volumeBar->setLeftRightMargin(8); volumeBar->setMinimum(0); volumeBar->setMaximum(100); volumeBar->setDelayPeriod(1); volumeBar->setFrozenPeriod(10); QHBoxLayout* upperLayout = new QHBoxLayout; QHBoxLayout* lowerLayout = new QHBoxLayout; QVBoxLayout* mainLayout = new QVBoxLayout; upperLayout->addWidget(muteButton); upperLayout->addWidget(volumeBar); upperLayout->addWidget(maxButton); upperLayout->setContentsMargins(0, 0, 0, 0); upperLayout->setSpacing(0); QSpacerItem* sp1 = new QSpacerItem(1, 10, QSizePolicy::Expanding, QSizePolicy::Preferred); lowerLayout->addSpacerItem(sp1); lowerLayout->addWidget(fullscreenButton); lowerLayout->addWidget(playlistButton); lowerLayout->addWidget(equalizerButton); QSpacerItem* sp2 = new QSpacerItem(1, 10, QSizePolicy::Expanding, QSizePolicy::Preferred); lowerLayout->addSpacerItem(sp2); lowerLayout->setContentsMargins(0, 0, 0, 0); lowerLayout->setSpacing(0); mainLayout->addLayout(upperLayout); mainLayout->addLayout(lowerLayout); mainLayout->setContentsMargins(0,8,5,8); mainLayout->setSpacing(2); setLayout(mainLayout); connect(muteButton, SIGNAL(clicked()), this, SLOT(setVolumeMin())); connect(maxButton, SIGNAL(clicked()), this, SLOT(setVolumeMax())); connect(volumeBar, SIGNAL(valueChanged(int)), this, SIGNAL(volumeChanged(int))); connect(volumeBar, SIGNAL(sliderMoved(int)), this, SIGNAL(volumeSliderMoved(int))); }
SettingsSelector::SettingsSelector(QWidget *parent) : QWidget(parent) { QHBoxLayout *layout = new QHBoxLayout(this); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(6); m_configurationCombo = new QComboBox(this); m_configurationCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents); m_configurationCombo->setMinimumContentsLength(80); m_addButton = new QPushButton(tr("Add"), this); m_removeButton = new QPushButton(tr("Remove"), this); m_renameButton = new QPushButton(tr("Rename"), this); m_label = new QLabel(this); m_label->setMinimumWidth(200); m_label->setBuddy(m_configurationCombo); layout->addWidget(m_label); layout->addWidget(m_configurationCombo); layout->addWidget(m_addButton); layout->addWidget(m_removeButton); layout->addWidget(m_renameButton); layout->addSpacerItem(new QSpacerItem(0, 0)); updateButtonState(); connect(m_addButton, SIGNAL(clicked()), this, SIGNAL(add())); connect(m_removeButton, SIGNAL(clicked()), this, SLOT(removeButtonClicked())); connect(m_renameButton, SIGNAL(clicked()), this, SLOT(renameButtonClicked())); connect(m_configurationCombo, SIGNAL(currentIndexChanged(int)), this, SIGNAL(currentChanged(int))); }
NewWizardPage4::NewWizardPage4(QWidget* parent) : QWizardPage(parent) { setFinalPage(true); setTitle(tr("Create New Score")); setSubTitle(tr("Choose template file:")); setAccessibleName(title()); setAccessibleDescription(subTitle()); templateFileBrowser = new ScoreBrowser; templateFileBrowser->setStripNumbers(true); templateFileBrowser->setShowCustomCategory(true); templateFileBrowser->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored)); buildTemplatesList(); QVBoxLayout* layout = new QVBoxLayout; QHBoxLayout* searchLayout = new QHBoxLayout; QLineEdit* search = new QLineEdit; search->setPlaceholderText(tr("Search")); search->setClearButtonEnabled(true); search->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); searchLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding, QSizePolicy::Maximum)); searchLayout->addWidget(search); layout->addLayout(searchLayout); layout->addWidget(templateFileBrowser); setLayout(layout); connect(templateFileBrowser, SIGNAL(scoreSelected(const QString&)), SLOT(templateChanged(const QString&))); connect(templateFileBrowser, SIGNAL(scoreActivated(const QString&)), SLOT(fileAccepted(const QString&))); connect(search, &QLineEdit::textChanged, [this] (const QString& searchString) { this->templateFileBrowser->filter(searchString); }); }
WITToolPanel::WITToolPanel(QWidget *parent) : QWidget(parent) { QHBoxLayout *vbox = new QHBoxLayout(); QButtonGroup *bgroup = new QButtonGroup(); QPushButton *b1 = new QPushButton("Touch"); QPushButton *b2 = new QPushButton("Surface"); QPushButton *b3 = new QPushButton("Stats"); QPushButton *b4 = new QPushButton("VOI"); b1->setCheckable(true); b2->setCheckable(true); b3->setCheckable(true); b4->setCheckable(true); bgroup->addButton(b1); bgroup->addButton(b2); bgroup->addButton(b3); bgroup->addButton(b4); QHBoxLayout *hbox = new QHBoxLayout(); hbox->addWidget(b1); hbox->addWidget(b2); hbox->addWidget(b3); hbox->addWidget(b4); hbox->addSpacerItem(new QSpacerItem(0,0,QSizePolicy::Expanding, QSizePolicy::Expanding)); vbox->addLayout(hbox); setLayout(vbox); }
QWidget * PrefsDialog::createAutosaveForm() { QGroupBox * autosave = new QGroupBox(tr("Autosave"), this ); QHBoxLayout * zhlayout = new QHBoxLayout(); zhlayout->setSpacing(SPACING); QCheckBox * box = new QCheckBox(tr("Autosave every:")); box->setChecked(MainWindow::AutosaveEnabled); zhlayout->addWidget(box); zhlayout->addSpacerItem(new QSpacerItem(0,0,QSizePolicy::Expanding)); QSpinBox * spinBox = new QSpinBox; spinBox->setMinimum(1); spinBox->setMaximum(60); spinBox->setValue(MainWindow::AutosaveTimeoutMinutes); spinBox->setMaximumWidth(80); zhlayout->addWidget(spinBox); QLabel * label = new QLabel(tr("minutes")); zhlayout->addWidget(label); autosave->setLayout(zhlayout); connect(box, SIGNAL(clicked(bool)), this, SLOT(toggleAutosave(bool))); connect(spinBox, SIGNAL(valueChanged(int)), this, SLOT(changeAutosavePeriod(int))); return autosave; }
QTitleWidget::QTitleWidget(QWidget *parent) : QWidget(parent) { QHBoxLayout *hl = new QHBoxLayout; hl->setMargin(0); hl->setSpacing(0); setObjectName("titleWidget"); QLabel * label = new QLabel; QImage image(":/inner/images/begin.png"); label->setPixmap(QPixmap::fromImage(image)); label->setFixedSize(16,16); QAction * ac = new QAction(QIcon(":/inner/images/delete_item.png"),tr("Remove Item"),this); m_delButton = new QToolBarButton(ac); ac = new QAction(QIcon(":/inner/images/add.png"),tr("Add Title"),this); m_addTitleButton = new QToolBarButton(ac); m_addTitleButton->setVisible(true); hl->addWidget(m_addTitleButton); hl->addWidget(label); hl->addSpacerItem(new QSpacerItem(1,1,QSizePolicy::Expanding, QSizePolicy::Expanding)); hl->addWidget(m_delButton); setLayout(hl); setStyleSheet("#titleWidget{background-color:rgb(255,220,180);}"); setFixedHeight(22); connect(m_addTitleButton,SIGNAL(clicked()),this,SIGNAL(addTitle())); connect(m_delButton,SIGNAL(clicked()),this,SIGNAL(delItem())); }
ScrollingWidget::ScrollingWidget(QWidget *parent) : QScrollArea(parent), _direction(true) { _timer = new QTimer(this); QWidget *widget = new QWidget(this); _label = new QLabel(widget); QHBoxLayout *layout = new QHBoxLayout; layout->setContentsMargins(4,0,4,0); layout->setSpacing(10); layout->addWidget(_label); layout->addSpacerItem(new QSpacerItem(10, 10, QSizePolicy::Expanding, QSizePolicy::Fixed)); widget->setLayout(layout); setWidget(widget); setWidgetResizable(true); setMaximumHeight(35); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); connect(_label, SIGNAL(linkActivated(QString)), this, SIGNAL(open(QString))); connect(_timer, SIGNAL(timeout()), this, SLOT(scroll())); _timer->start(50); }
void MainWindow::setupGUI() { int const n_chars (static_cast<int>(_data.char_names.size())); for (int i=0; i<n_chars; ++i) { QLabel* label = new QLabel(this); label->setText(bold + QString::fromStdString(_data.char_names[i]) + end); label->setAlignment(Qt::AlignCenter); this->central_layout->addWidget(label, 0, i+1); } int const n_skills (static_cast<int>(_data.skill_names.size())); for (int j=0; j<n_skills; ++j) { QLabel* label = new QLabel(this); label->setText(normal + QString::fromStdString(_data.skill_names[j]) + end); this->central_layout->addWidget(label, j+1, 0); for (int i=0; i<n_chars; ++i) this->central_layout->addWidget((_labels[j])[i], j+1, i+1); } QList<QAbstractButton*> const& list = _buttons->buttons(); auto it = list.constBegin(); for (int j=0; j<n_skills; ++j) this->central_layout->addWidget(dynamic_cast<QPushButton*>(*it++), j+1, n_chars+1); QHBoxLayout *hlayout = new QHBoxLayout(); this->central_layout->addLayout(hlayout, n_skills+1, 0); QSpacerItem *const item = new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Expanding); hlayout->addSpacerItem(item); }
void Widget::setDBPropreties() { changeBoard = new QGroupBox; changeBoard->setTitle("DB Options"); //changeBoard->setStyleSheet("border: 1px solid gray; border-radius: 9px; margin-top: 0.5em; border-color: red"); QHBoxLayout* nextAndPrevButtons = new QHBoxLayout; QPushButton* nextBoard = new QPushButton("next"); nextBoard->setObjectName("next"); connect(nextBoard,SIGNAL(clicked(bool)),this,SLOT(changeBoards())); QPushButton* prevBoard = new QPushButton("prev"); prevBoard->setObjectName("prev"); connect(prevBoard,SIGNAL(clicked(bool)),this,SLOT(changeBoards())); nextAndPrevButtons->addWidget(prevBoard); nextAndPrevButtons->addWidget(nextBoard); QHBoxLayout* customPathLayout = new QHBoxLayout; QLabel* customPath = new QLabel("custom"); customPath->setToolTip("enter path to board file. ex: <name>.txt"); newBoardPath = new QLineEdit(""); newBoardPath->setToolTip("enter path to board file. ex: <name>.txt"); QPushButton* newBoardPathLoad = new QPushButton("load"); newBoardPathLoad->setObjectName("load"); connect(newBoardPathLoad,SIGNAL(clicked(bool)),this,SLOT(changeBoards())); compareBoardPath = new QLineEdit(""); compareBoardPath->setReadOnly(true); compareBoardPath->setToolTip("path to solved board.after solving the board, comparing result with validated solution"); customPathLayout->addWidget(customPath); customPathLayout->addWidget(newBoardPath); customPathLayout->addWidget(newBoardPathLoad); customPathLayout->addWidget(compareBoardPath); QVBoxLayout* changeBoardLayout = new QVBoxLayout; changeBoardLayout->addLayout(nextAndPrevButtons); changeBoardLayout->addLayout(customPathLayout); changeBoard->setLayout(changeBoardLayout); QHBoxLayout* spacersLayout = new QHBoxLayout(); spacersLayout->addSpacerItem(new QSpacerItem(0,0,QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); spacersLayout->addWidget(changeBoard); spacersLayout->addSpacerItem(new QSpacerItem(0,0,QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); mainLayout->addLayout(spacersLayout); }
PESvgView::PESvgView(QWidget * parent) : QFrame(parent) { this->setObjectName("peSVG"); m_pegi = NULL; QVBoxLayout * mainLayout = new QVBoxLayout; m_filename = new QLabel(); mainLayout->addWidget(m_filename); QFrame * boundsFrame = new QFrame; QHBoxLayout * boundsLayout = new QHBoxLayout; QLabel * label = new QLabel("x:"); boundsLayout->addWidget(label); m_x = new QLabel; boundsLayout->addWidget(m_x); boundsLayout->addSpacing(PEUtils::Spacing); label = new QLabel("y:"); boundsLayout->addWidget(label); m_y = new QLabel; boundsLayout->addWidget(m_y); boundsLayout->addSpacing(PEUtils::Spacing); label = new QLabel(tr("width:")); boundsLayout->addWidget(label); m_width = new QLabel; boundsLayout->addWidget(m_width); boundsLayout->addSpacing(PEUtils::Spacing); label = new QLabel(tr("height:")); boundsLayout->addWidget(label); m_height = new QLabel; boundsLayout->addWidget(m_height); boundsLayout->addSpacing(PEUtils::Spacing); m_units = new QLabel(); boundsLayout->addWidget(m_units); boundsLayout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Expanding)); boundsFrame->setLayout(boundsLayout); mainLayout->addWidget(boundsFrame); m_svgElement = new QLabel; m_svgElement->setWordWrap(false); m_svgElement->setTextFormat(Qt::PlainText); mainLayout->addWidget(m_svgElement); mainLayout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding)); //this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); this->setLayout(mainLayout); }
//TODO Mariano: looks like an abstracteditable, perhaps can be one MismatchingConnectorWidget::MismatchingConnectorWidget(ConnectorsInfoWidget *topLevelContainer, ViewLayer::ViewIdentifier viewId, const QString &connId, QWidget *parent, bool isInView, Connector* conn) : AbstractConnectorInfoWidget(topLevelContainer, parent) { if(AllViews.size() == 0) { AllViews << ViewLayer::BreadboardView << ViewLayer::SchematicView << ViewLayer::PCBView; } m_prevConn = conn; m_connId = connId; m_connIdLabel = new QLabel(m_connId+":", this); m_connIdLabel->setObjectName("mismatchConnId"); m_connMsgLabel = new QLabel(viewsString(),this); m_connMsgLabel->setObjectName("mismatchConnMsg"); QLabel *errorImg = new QLabel(this); errorImg->setPixmap(QPixmap(":/resources/images/error_x_small.png")); if(isInView) { m_missingViews << ViewLayer::BreadboardView << ViewLayer::SchematicView << ViewLayer::PCBView; addViewPresence(viewId); } else { removeViewPresence(viewId); } QPushButton *completeConnBtn = new QPushButton(tr("fix this!"),this); connect(completeConnBtn,SIGNAL(clicked()),this,SLOT(emitCompletion())); QHBoxLayout *lo = new QHBoxLayout(); lo->addWidget(errorImg); lo->addSpacerItem(new QSpacerItem(5,0)); lo->addWidget(m_connIdLabel); lo->addWidget(m_connMsgLabel); lo->addSpacerItem(new QSpacerItem(0,0,QSizePolicy::Expanding,QSizePolicy::Expanding)); lo->addWidget(completeConnBtn); lo->addSpacerItem(new QSpacerItem(10,0,QSizePolicy::Minimum,QSizePolicy::Expanding)); lo->addWidget(m_removeButton); lo->setMargin(3); lo->setSpacing(3); this->setLayout(lo); //updateGeometry(); setMaximumHeight(SingleConnectorHeight); }
void FilterExpressionsPreferencesFrame::on_expressionTreeWidget_itemActivated(QTreeWidgetItem *item, int column) { if (!item || cur_line_edit_) return; QWidget *editor = NULL; cur_column_ = column; switch (column) { case label_col_: { cur_line_edit_ = new QLineEdit(); cur_column_ = column; saved_col_string_ = item->text(label_col_); connect(cur_line_edit_, SIGNAL(editingFinished()), this, SLOT(labelEditingFinished())); editor = cur_line_edit_; break; } case expression_col_: { SyntaxLineEdit *syntax_edit = new SyntaxLineEdit(); saved_col_string_ = item->text(expression_col_); connect(syntax_edit, SIGNAL(textChanged(QString)), this, SLOT(expressionTextChanged(QString))); connect(syntax_edit, SIGNAL(editingFinished()), this, SLOT(expressionEditingFinished())); editor = cur_line_edit_ = syntax_edit; break; } default: return; } if (cur_line_edit_) { cur_line_edit_->setText(saved_col_string_); cur_line_edit_->selectAll(); connect(cur_line_edit_, SIGNAL(destroyed()), this, SLOT(lineEditDestroyed())); } if (editor) { QFrame *edit_frame = new QFrame(); QHBoxLayout *hb = new QHBoxLayout(); QSpacerItem *spacer = new QSpacerItem(5, 10); hb->addWidget(editor, 0); hb->addSpacerItem(spacer); hb->setStretch(1, 1); hb->setContentsMargins(0, 0, 0, 0); edit_frame->setLineWidth(0); edit_frame->setFrameStyle(QFrame::NoFrame); // The documentation suggests setting autoFillbackground. That looks silly // so we clear the item text instead. item->setText(cur_column_, ""); edit_frame->setLayout(hb); ui->expressionTreeWidget->setItemWidget(item, cur_column_, edit_frame); editor->setFocus(); } }
QWidget *AppAboutPage::createPage(QWidget *parent) { QWidget *w = new QWidget(parent); QVBoxLayout *layout = new QVBoxLayout(w); layout->setSpacing(0); layout->setMargin(0); // Splash label QWidget *sw = new QWidget(w); QHBoxLayout *swLayout = new QHBoxLayout(sw); sw->setLayout(swLayout); QLabel *splash = new QLabel(w); splash->setPixmap(theme()->splashScreenPixmap(settings()->path(Core::ISettings::SplashScreen))); splash->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); swLayout->addSpacerItem(new QSpacerItem(10, 10, QSizePolicy::Expanding)); swLayout->addWidget(splash); swLayout->addSpacerItem(new QSpacerItem(10, 10, QSizePolicy::Expanding)); layout->addWidget(sw); QFrame *line = new QFrame(w); line->setFrameShape(QFrame::HLine); line->setFrameShadow(QFrame::Sunken); layout->addWidget(line); layout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Fixed, QSizePolicy::Fixed)); // Welcome label QLabel *label = new QLabel(w); label->setWordWrap(true); label->setOpenExternalLinks(true); layout->addWidget(label); layout->addSpacerItem(new QSpacerItem(20,20, QSizePolicy::Expanding, QSizePolicy::Expanding)); label->clear(); Utils::UpdateChecker *up = Core::ICore::instance()->updateChecker(); QString tmp = tkTr(Trans::Constants::APPLICATION_ABOUT_YEAR_1_WEB_2) .arg(QDate::currentDate().year()) .arg(qApp->organizationDomain()); if (up->hasUpdate()) { tmp.append(tkTr(Trans::Constants::UPDATE_AVAILABLE)); } else { tmp.append(tkTr(Trans::Constants::VERSION_UPTODATE)); } label->setText(tmp); return w; }
AboutDialog::AboutDialog(QDialog *parent) : QDialog(parent) { QVBoxLayout *mainLayout = new QVBoxLayout(); this->setLayout(mainLayout); QWebView *page = new QWebView(); QPushButton *okButton = new QPushButton(); okButton->setText(tr("OK")); mainLayout->addWidget(page); QHBoxLayout *buttonLayout = new QHBoxLayout(); QSpacerItem *spacer1 = new QSpacerItem(100000,1, QSizePolicy::Maximum); QSpacerItem *spacer2 = new QSpacerItem(100000,1, QSizePolicy::Maximum); buttonLayout->addSpacerItem(spacer1); buttonLayout->addWidget(okButton); buttonLayout->addSpacerItem(spacer2); mainLayout->addLayout(buttonLayout); this->setLayout(mainLayout); QString file = global.fileManager.getProgramDirPath("") + "/help/about.html"; QFile f(file); if(!f.open(QFile::ReadOnly)) return; QTextStream is(&f); QString data = is.readAll(); QString translationInformation = tr("Note to translators: For translation credit, change this message to your name & contact information and it will appear in the About dialog box. HTML Formatting is available."); QString translationStaticInformation = "Note to translators: For translation credit, change this message to your name & contact information and it will appear in the About dialog box. HTML Formatting is available."; if (translationInformation == translationStaticInformation) { data.replace("__TRANSLATION__", ""); } else { data = data.replace("__TRANSLATION__", translationInformation); } #ifndef _WIN32 data = data.replace("__LOGO__", "file://"+global.fileManager.getImageDirPath("")+"splash_logo.png"); #else data = data.replace("__LOGO__", "file:///"+global.fileManager.getImageDirPath("").replace("\\","/")+"splash_logo.png"); #endif page->setHtml(data); connect(okButton, SIGNAL(clicked()), this, SLOT(close())); this->resize(600,500); this->setFont(global.getGuiFont(font())); }
void FramelessDlg::InitTitleBar() { QVBoxLayout* layout = qobject_cast<QVBoxLayout*>(this->layout()); m_closeBtn = new QToolButton(this); QToolButton* minBtn = new QToolButton(this); QToolButton* menuBtn = new QToolButton(this); m_subTitle = new QLabel(this); m_subTitle->setAlignment(Qt::AlignRight | Qt::AlignVCenter); m_closeBtn->setObjectName("closeBtn"); minBtn->setObjectName("minBtn"); menuBtn->setObjectName("menuBtn"); m_subTitle->setObjectName("subTitle"); menuBtn->setPopupMode(QToolButton::InstantPopup); m_menu = new QMenu(this); menuBtn->setMenu(m_menu); m_closeBtn->setFixedSize(27, 22); minBtn->setFixedSize(27, 22); menuBtn->setFixedSize(27, 22); m_subTitle->setFixedSize(400, 25); connect(m_closeBtn, SIGNAL(clicked()), this, SLOT(reject())); connect(m_closeBtn, SIGNAL(clicked()), this, SLOT(close())); connect(minBtn, SIGNAL(clicked()), this, SLOT(showMinimized())); QFrame* tb = new QFrame(this); tb->setObjectName("titleBar"); QHBoxLayout* tbLayout = new QHBoxLayout; m_title = new QLabel(this); m_title->setObjectName("label_title"); m_title->setFixedSize(300, 25); tbLayout->addWidget(m_title); tbLayout->addSpacerItem(new QSpacerItem(20, 40, QSizePolicy::Expanding, QSizePolicy::Fixed)); if ( m_flag & SUB_TITLE ) tbLayout->addWidget(m_subTitle); if ( m_flag & MENU_BUTTON ) tbLayout->addWidget(menuBtn); if ( m_flag & MIN_BUTTON ) tbLayout->addWidget(minBtn); if ( m_flag & CLOSE_BUTTON ) tbLayout->addWidget(m_closeBtn); tb->setLayout(tbLayout); layout->addWidget(tb); }
ui_layout& ui_layout::operator<<(const Literal<hbox_start_>&) { QBoxLayout* l = stack_.top(); QHBoxLayout* n = new QHBoxLayout(); n->addSpacerItem(new QSpacerItem(0,0, QSizePolicy::Expanding, QSizePolicy::Expanding)); l->addLayout(n, 1000); set_stretch_for_last_item(1); stack_.push(n); return *this; }
Lvk::FE::NewUpdateDialog::NewUpdateDialog(const DAS::UpdateInfo &info, QWidget *parent) : QDialog(parent), m_url(info.url()), m_downloadAccepted(false) { setModal(true); setMinimumWidth(600); setMaximumWidth(600); setWindowTitle(tr("New Update")); m_label = new QLabel(this); m_label->setWordWrap(true); m_label->setOpenExternalLinks(true); m_hash = new QLabel(this); m_hash->setTextInteractionFlags(m_label->textInteractionFlags() | Qt::TextSelectableByMouse); m_hash->setCursor(QCursor(Qt::IBeamCursor)); m_copy = new QToolButton(this); m_copy->setAutoRaise(true); m_copy->setIcon(QIcon(":/icons/copy.png")); m_copy->setToolTip(tr("Copy signature")); m_later = new QPushButton(tr("Later"), this); m_download = new QPushButton(tr("Download Now!"), this); m_download->setDefault(true); m_download->setFocus(); QGridLayout *mainLayout = new QGridLayout(this); setLayout(mainLayout); QHBoxLayout *hashLayout = new QHBoxLayout(); QSpacerItem *vspacer = new QSpacerItem(0, 0, QSizePolicy::Fixed, QSizePolicy::Expanding); QSpacerItem *hspacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Fixed); mainLayout->addWidget (m_label, 0, 0, 1, 3); mainLayout->addLayout (hashLayout, 1, 0, 1, 3); mainLayout->addItem (vspacer, 2, 0, 1, 3); mainLayout->addItem (hspacer, 3, 0); mainLayout->addWidget (m_later, 3, 1); mainLayout->addWidget (m_download, 3, 2); hashLayout->setMargin(0); hashLayout->addWidget(m_hash); hashLayout->addWidget(m_copy); hashLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Fixed)); connect(m_download, SIGNAL(clicked()), SLOT(onAccepted())); connect(m_later, SIGNAL(clicked()), SLOT(onRejected())); connect(m_copy, SIGNAL(clicked()), SLOT(onCopyHash())); setUpdateInfo(info); }
TimelineWidget::TimelineWidget(Animation* animation, AnimationEditor* parent, NetworkEvaluator* networkEval) : QWidget(parent) , animation_(animation) , currentTime_(0) , changed_(false) { // register as observer in the core animation_->addObserver(this); setMinimumWidth(550); mainLayout_ = new QVBoxLayout(this); QHBoxLayout* controlLayout = new QHBoxLayout(); timeBox_ = new QGroupBox(tr("Time"), this); QHBoxLayout* timeLayout = new QHBoxLayout(); timeBox_->setLayout(timeLayout); timeCounter_ = new QLabel(this); timeCounter_->setText("00:00"); timeBox_->setFixedWidth(timeBox_->width()); timeLayout->addWidget(timeCounter_); mainLayout_->addLayout(controlLayout); controlLayout->addWidget(timeBox_); controlLayout->addSpacerItem(new QSpacerItem(180,0)); overviewTimeline_ = new OverviewWidget(this, networkEval); controlLayout->addWidget(overviewTimeline_); connect(this, SIGNAL(viewResizeSignal(int)), overviewTimeline_, SLOT(updateViewportRect(int))); connect(this, SIGNAL(autoPreview(bool)), overviewTimeline_, SLOT(autoPreview(bool))); connect(this, SIGNAL(durationChanged(int)), overviewTimeline_, SLOT(setDuration(int))); connect(overviewTimeline_, SIGNAL(currentFrameChanged(int)), this, SIGNAL(currentFrameChanged(int))); connect(overviewTimeline_, SIGNAL(recordAt(int)), this, SIGNAL(recordAt(int))); connect(parent, SIGNAL(currentFrameChanged(int)), overviewTimeline_, SLOT(setCurrentFrame(int))); connect(overviewTimeline_, SIGNAL(currentFrameChanged(int)), parent, SLOT(setCurrentFrame(int))); connect(this, SIGNAL(scrollBarOrder(int)), overviewTimeline_, SLOT(scrollBarOrder(int))); connect(this, SIGNAL(sceneOrder(QMatrix)), overviewTimeline_, SLOT(sceneOrder(QMatrix))); mainLayout_->setMargin(1); mainLayout_->setSpacing(1); mainLayout_->setAlignment(Qt::AlignTop); scrollArea_ = new QScrollArea(); QWidget* container = new QWidget(scrollArea_); scrollArea_->setWidget(container); scrollAreaLayout_ = new QVBoxLayout(container);; scrollAreaLayout_->setSizeConstraint(QLayout::SetMinimumSize); mainLayout_->addWidget(scrollArea_); scrollArea_->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); scrollArea_->setAlignment(Qt::AlignTop); populateProcessors(); }
AboutDialog::AboutDialog(QDialog *parent) : QDialog(parent) { QVBoxLayout *mainLayout = new QVBoxLayout(); this->setLayout(mainLayout); QWebView *page = new QWebView(); QPushButton *okButton = new QPushButton(); okButton->setText(tr("OK")); mainLayout->addWidget(page); QHBoxLayout *buttonLayout = new QHBoxLayout(); QSpacerItem *spacer1 = new QSpacerItem(100000, 1, QSizePolicy::Maximum); QSpacerItem *spacer2 = new QSpacerItem(100000, 1, QSizePolicy::Maximum); buttonLayout->addSpacerItem(spacer1); buttonLayout->addWidget(okButton); buttonLayout->addSpacerItem(spacer2); mainLayout->addLayout(buttonLayout); this->setLayout(mainLayout); const QString programDataDir = global.fileManager.getProgramDataDir(); QString versionStr = tr("Version: ") + global.fileManager.getProgramVersionPrintable(); QString aboutFileName = programDataDir + "help/about.html"; QString data = global.fileManager.readFile(aboutFileName); #define TR_TX "Note to translators: For translation credit, change this message to your name & contact information and it will appear in the About dialog box. HTML Formatting is available." QString translationInformation = tr(TR_TX); QString translationStaticInformation = TR_TX; if (translationInformation == translationStaticInformation) { data.replace("__TRANSLATION__", ""); } else { data = data.replace("__TRANSLATION__", translationInformation); } data.replace("__VERSION__", versionStr); data = data.replace("__LOGO__", "file://" + global.fileManager.getImageDirPath("") + "splash_logo.png"); page->setHtml(data); connect(okButton, SIGNAL(clicked()), this, SLOT(close())); this->resize(600, 500); this->setFont(global.getGuiFont(font())); }
FilterDialog::FilterDialog(QHash<int, QString> captions, QWidget *parent, Qt::WindowFlags f) :QDialog(parent, f), m_captions(captions) { model = new QStandardItemModel(this); model->setColumnCount(ColumnCount); filterView = new QTableView(this); filterView->setModel(model); filterView->setItemDelegate(new FilterDelegate(m_captions, filterView)); actionAdd = new QAction(this); actionAdd->setIcon(QIcon(":share/images/add.png")); connect(actionAdd, SIGNAL(triggered()), this, SLOT(add())); addButton = new QToolButton(this); addButton->setDefaultAction(actionAdd); addButton->setAutoRaise(true); actionRemove = new QAction(this); actionRemove->setIcon(QIcon(":share/images/remove.png")); connect(actionRemove, SIGNAL(triggered()), this, SLOT(remove())); removeButton = new QToolButton(this); removeButton->setDefaultAction(actionRemove); removeButton->setAutoRaise(true); QHBoxLayout *buttonsLayout = new QHBoxLayout(); buttonsLayout->addWidget(addButton); buttonsLayout->addWidget(removeButton); buttonsLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Preferred)); QVBoxLayout *viewLayout = new QVBoxLayout(); viewLayout->addLayout(buttonsLayout); viewLayout->addWidget(filterView); QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this); buttons->setCenterButtons(true); connect(buttons, SIGNAL(accepted()), this, SLOT(accept())); connect(buttons, SIGNAL(rejected()), this, SLOT(reject())); QVBoxLayout *mainLayout = new QVBoxLayout(); mainLayout->addLayout(viewLayout); mainLayout->addWidget(buttons); setLayout(mainLayout); loadSettings(); retranslateStrings(); }