GNumericalExpressionSettingsWidget::GNumericalExpressionSettingsWidget( GNumericalExpression* numericalExpression, QObject* parent /*= NULL*/) { m_NumericalExpression = numericalExpression; QGroupBox* pExpressionSettings = new QGroupBox; QBoxLayout* pExpressionSettingsLayout = new QVBoxLayout; QBoxLayout* pExpressionEditLayout = new QHBoxLayout; pExpressionSettings->setFixedWidth(400); pExpressionSettings->setTitle("Expression Settings"); pExpressionSettings->setLayout(pExpressionSettingsLayout); pExpressionEditLayout->insertWidget(0, new QLabel("Expression:"), 0); pExpressionEditLayout->insertWidget(1, m_NumericalExpression->m_Expression.ProvideNewParamLineEdit(pExpressionSettings), 0); pExpressionSettingsLayout->insertLayout(0, pExpressionEditLayout); QGroupBox* pVariableSettings = new QGroupBox; QGroupBox* pShowVariables = new QGroupBox; QBoxLayout* pShowVariablesLayout = new QVBoxLayout; QBoxLayout* pVariableSettingsLayout = new QVBoxLayout; QRadioButton* pLayoutVariablesVertically = new QRadioButton; QRadioButton* pLayoutVariablesHorizontally = new QRadioButton; QRadioButton* pLayoutVariablesGrid = new QRadioButton; pVariableSettings->setFixedWidth(400); pVariableSettings->setTitle("Variable Settings"); pVariableSettings->setLayout(pVariableSettingsLayout); pShowVariables->setTitle("Show Variables"); pShowVariables->setCheckable(true); pShowVariables->setLayout(pShowVariablesLayout); pLayoutVariablesHorizontally->setText("Layout: Horizontal"); pShowVariablesLayout->insertWidget(0, pLayoutVariablesHorizontally); pLayoutVariablesVertically->setText("Layout: Vertical"); pShowVariablesLayout->insertWidget(1, pLayoutVariablesVertically); pLayoutVariablesGrid->setText("Layout: Grid"); pShowVariablesLayout->insertWidget(2, pLayoutVariablesGrid); pVariableSettingsLayout->insertWidget(0, pShowVariables); QPushButton* pAcceptButton = new QPushButton; QPushButton* pCloseButton = new QPushButton; QBoxLayout* pButtonLayout = new QHBoxLayout; pAcceptButton->setText("Accept"); connect(pAcceptButton, SIGNAL(clicked(bool)), this, SLOT(Accept())); pCloseButton->setText("Close"); connect(pCloseButton, SIGNAL(clicked(bool)), this, SLOT(close())); pButtonLayout->insertWidget(0, pAcceptButton, 1); pButtonLayout->insertWidget(1, pCloseButton, 1); QBoxLayout* pMainLayout = new QVBoxLayout; pMainLayout->setSizeConstraint(QLayout::SetFixedSize); setLayout(pMainLayout); pMainLayout->insertWidget(0, pExpressionSettings, 1); pMainLayout->insertWidget(1, pVariableSettings, 1); pMainLayout->insertLayout(2, pButtonLayout, 0); }
void layoutOperations::insertLayoutItem( int Index, QWidget *Widget, QLayoutItem *Item, int Stretch ) { if ( Widget == NULL ) return; QBoxLayout *Layout = dynamic_cast<QBoxLayout*>( Widget->layout() ); if ( Layout == NULL ) return; do { QWidget *ItemWidget = Item->widget(); if ( ItemWidget != NULL ) { Layout->insertWidget( Index, ItemWidget, Stretch ); break; } QLayout *ItemLayout = Item->layout(); if ( ItemLayout != NULL ) { Layout->insertLayout( Index, ItemLayout, Stretch ); break; } QSpacerItem *ItemSpace = Item->spacerItem(); if ( ItemSpace != NULL ) { Layout->insertSpacerItem( Index, ItemSpace ); break; } } while ( false ); }
DlgHidden::DlgHidden(QWidget* parent, ConfigObject<ConfigValue>* pConfig, TrackCollection* pTrackCollection, MixxxKeyboard* pKeyboard) : QWidget(parent), Ui::DlgHidden(), m_pTrackTableView( new WTrackTableView(this,pConfig,pTrackCollection, false)) { setupUi(this); m_pTrackTableView->installEventFilter(pKeyboard); // Install our own trackTable QBoxLayout* box = dynamic_cast<QBoxLayout*>(layout()); Q_ASSERT(box); //Assumes the form layout is a QVBox/QHBoxLayout! box->removeWidget(m_pTrackTablePlaceholder); m_pTrackTablePlaceholder->hide(); box->insertWidget(1, m_pTrackTableView); m_pHiddenTableModel = new HiddenTableModel(this, pTrackCollection); m_pTrackTableView->loadTrackModel(m_pHiddenTableModel); connect(btnUnhide, SIGNAL(clicked()), m_pTrackTableView, SLOT(slotUnhide())); connect(btnUnhide, SIGNAL(clicked()), this, SLOT(clicked())); connect(btnPurge, SIGNAL(clicked()), m_pTrackTableView, SLOT(slotPurge())); connect(btnPurge, SIGNAL(clicked()), this, SLOT(clicked())); connect(btnSelect, SIGNAL(clicked()), this, SLOT(selectAll())); connect(m_pTrackTableView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), this, SLOT(selectionChanged(const QItemSelection&, const QItemSelection&))); }
void SettingsDetailViewUI::addSectionViews( QList<ISettingsSectionView *> sections ) { QBoxLayout *layout = qobject_cast<QBoxLayout *>( _ui->_sectionsContainer->layout() ); if( layout != NULL ) for( int i = 0; i < sections.count() ; i++ ) layout->insertWidget( i, sections.at( i ) ); }
void FileRenamerDlgImpl::createButtons() { QBoxLayout* pLayout (dynamic_cast<QBoxLayout*>(m_pButtonsW->layout())); CB_ASSERT (0 != pLayout); /*int nPos (pLayout->indexOf(pOldBtn)); pLayout->insertWidget(nPos, this);*/ QObjectList l (m_pButtonsW->children()); //qDebug("cnt: %d", l.size()); for (int i = 1, n = l.size(); i < n; ++i) // l[0] is m_pButtonsW's layout (note that m_pAlbumTypeL is in m_pBtnPanelW) { delete l[i]; } for (int i = 0, n = cSize(m_vstrPatterns); i < n; ++i) { QToolButton* p (new QToolButton(m_pButtonsW)); p->setText(toNativeSeparators(convStr(m_vstrPatterns[i]))); p->setCheckable(true); m_pButtonGroup->addButton(p, m_nBtnId++); //p->setAutoExclusive(true); connect(p, SIGNAL(clicked()), this, SLOT(onPatternClicked())); pLayout->insertWidget(i, p); } }
void AdvancedWidget<BaseClass>::updateHeaderState() { QBoxLayout* bl = getMainLayout(); if(!bl) { return; } if(isUseBorder()) { WindowHeader *wh = getWindowHeader(); if (wh) { bl->removeWidget(wh); wh->deleteLater(); } setMousetTrackingForWidgetWithChildren(this, false); } else { WindowHeader* wh = new WindowHeader(this); wh->setCaption(BaseClass::windowTitle()); bl->insertWidget(0, wh); setMousetTrackingForWidgetWithChildren(this, true); } }
KstViewScalarsDialogI::KstViewScalarsDialogI(QWidget* parent, const char* name, bool modal, WFlags fl) : KstViewScalarsDialog(parent, name, modal, fl) { tableScalars = new KstScalarTable(this, "tableScalars"); tableScalars->setNumRows(0); tableScalars->setNumCols(2); tableScalars->setReadOnly(true); tableScalars->setSorting(false); tableScalars->setSelectionMode(QTable::Single); QBoxLayout *box = dynamic_cast<QBoxLayout*>(layout()); if (box) { box->insertWidget(0, tableScalars); if (tableScalars->numCols() != 2) { for (; 0 < tableScalars->numCols(); ) { tableScalars->removeColumn(0); } tableScalars->insertColumns(0, 2); } tableScalars->setReadOnly(true); languageChange(); } connect(Cancel, SIGNAL(clicked()), this, SLOT(close())); }
void QIDialogButtonBox::addExtraWidget (QWidget* aWidget) { QBoxLayout *layout = boxLayout(); int index = findEmptySpace (layout); layout->insertWidget (index + 1, aWidget); layout->insertStretch(index + 2); }
//////////////// // Protected //////////////// //! Set the GUI widgets. void rtEPDataObject::setupGUI() { m_optionsWidget.setupUi(getBaseWidget()); QBoxLayout *temp; // The cine widget temp = static_cast<QBoxLayout*>(m_optionsWidget.epTabs->widget(1)->layout()); temp->insertWidget(0, &m_cineWidget); temp = static_cast<QBoxLayout*>(m_optionsWidget.epTabs->widget(2)->layout()); temp->insertWidget(0, &m_objectSelectionBox); m_objectSelectionBox.addObjectType("OT_3DPointBuffer"); m_optionsWidget.surfaceOpacitySlider->setValue(100); m_optionsWidget.pointsOpacitySlider->setValue(100); m_optionsWidget.surfaceOpacityLabel->setText("100 %"); m_optionsWidget.pointsOpacityLabel->setText("100 %"); m_optionsWidget.repComboBox->insertItem(EP_SURFACE, "Surface"); m_optionsWidget.repComboBox->insertItem(EP_WIREFRAME, "Wireframe"); m_optionsWidget.repComboBox->insertItem(EP_POINTS, "Points"); m_optionsWidget.repComboBox->setCurrentIndex(EP_SURFACE); connect(m_optionsWidget.surfaceOpacitySlider, SIGNAL(valueChanged(int)), this, SLOT(surfaceOpacityChanged(int))); connect(m_optionsWidget.pointsOpacitySlider, SIGNAL(valueChanged(int)), this, SLOT(pointsOpacityChanged(int))); connect(m_optionsWidget.repComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(representationChanged(int))); connect(m_optionsWidget.minSliceSlider, SIGNAL(valueChanged(int)), this, SLOT(minSliceChanged(int))); connect(m_optionsWidget.maxSliceSlider, SIGNAL(valueChanged(int)), this, SLOT(maxSliceChanged(int))); connect(m_optionsWidget.applyAllNow, SIGNAL(clicked()), this, SLOT(updateObjectNow())); connect(&m_cineWidget, SIGNAL(triggerChanged(int)), this, SLOT(triggerChanged(int))); connect(&m_objectSelectionBox, SIGNAL(objectSelectionChanged(int)), this, SLOT(cartoPointObjectChanged(int))); connect(&m_objectSelectionBox, SIGNAL(selectedObjectModified(int)), this, SLOT(cartoPointObjectChanged(int))); connect(m_optionsWidget.inSliceSpace, SIGNAL(valueChanged(double)), this, SLOT(inSliceValueChanged(double))); connect(m_optionsWidget.betweenSliceSpace, SIGNAL(valueChanged(double)), this, SLOT(betweenSliceValueChanged(double))); connect(m_optionsWidget.colorByComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(colorByPropertyChanged(int))); connect(m_optionsWidget.effectSlider, SIGNAL(valueChanged(int)), this, SLOT(effectSizeChanged(int))); connect(m_optionsWidget.showPointsCheckBox, SIGNAL(toggled(bool)), this, SLOT(showPointsChanged(bool))); }
KstViewScalarsDialog::KstViewScalarsDialog(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) : QDialog(parent, fl) { setupUi(this); _listViewScalars = new KstScalarListView(this, &KST::scalarList); _listViewScalars->setShowSortIndicator(false); _searchWidget = new KListViewSearchLineWidget(listViewScalars, this); QBoxLayout *box = dynamic_cast<QBoxLayout*>(layout()); if (box) { box->insertWidget(0, searchWidget); box->insertWidget(1, listViewScalars); languageChange(); } connect(Cancel, SIGNAL(clicked()), this, SLOT(close())); }
void ChatWindow::addAvatarFrame() { QBoxLayout * glayout = dynamic_cast<QBoxLayout *>(layout()); _avatarFrame->setVisible(true); //_avatarFrame->setMinimumSize(64, 0); glayout->insertWidget(1, _avatarFrame); _isAvatarFrameOpened = true; ui.avatarFrameButton->setIcon(QIcon(":images/show_toolbox_frame.png")); update(); }
void TokenDropTarget::drop( Token *token, const QPoint &pos ) { if ( !token ) return; // unlayout in case of move if ( QBoxLayout *box = rowBox( token ) ) box->removeWidget( token ); token->setParent( parentWidget() ); QBoxLayout *box = 0; if ( Token *brother = qobject_cast<Token*>( childAt( pos ) ) ) { // we hit a sibling, -> prepend QPoint idx; box = rowBox( brother, &idx ); if ( pos.x() > brother->geometry().x() + 2*brother->width()/3 ) box->insertWidget( idx.x() + 1, token ); else box->insertWidget( idx.x(), token ); } else { if ( rowLimit() && rows() >= (int)rowLimit() ) // we usually don't want more rows box = qobject_cast<QBoxLayout*>( layout()->itemAt( rows() - 1 )->layout() ); if ( !box ) { box = rowBox( pos ); // maybe this is on an existing row if ( !box ) box = appendRow(); } int idx = ( box->count() > trailingStretch && box->itemAt(0)->widget() && pos.x() < box->itemAt(0)->widget()->geometry().x() ) ? 0 : box->count() - trailingStretch; box->insertWidget( idx, token ); // append to existing row } token->show(); update(); // count changed emit changed(); token->setFocus( Qt::OtherFocusReason ); // select the new token right away }
void NewSubjectView::addResultMessageWidget(const QString& txt, bool type) { removeResultMessageWidget(); if(type) resultMessageWidget = ResultMessageWidget::successWidget(txt, this); else resultMessageWidget = ResultMessageWidget::errorWidget(txt, this); QBoxLayout * layout = qobject_cast<QBoxLayout*>(groupBox->layout()); layout->insertWidget(0, resultMessageWidget, 0, Qt::AlignHCenter); }
void TDockWidget::setWidget(QWidget *widget) { if (widget) { QBoxLayout *boxLayout = static_cast<QBoxLayout *>(layout()); if (m_widget && m_widget != widget) boxLayout->removeWidget(m_widget); boxLayout->insertWidget(1, widget); widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); m_widget = widget; } }
void DetachedWidgetController::AddButton(QPushButton *button) { button->setParent(this); button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); QBoxLayout* layout = dynamic_cast<QBoxLayout*>(this->buttongroup->layout()); if(!layout) return; layout->insertWidget(0,button); button->show(); this->update(); }
void BottomUICreator::initResizeWidget() { DraggableLabel *resizeLabel = new DraggableLabel( _ui->_resizeWidgetContainer ); QPixmap pixmap( Constants::BOTTOM_UI_IMAGE_DIR + Constants::BOTTOM_UI_RESIZE_URL ); resizeLabel->setPixmap( pixmap ); QBoxLayout *resizeLayout = qobject_cast<QBoxLayout *>( _ui->_resizeWidgetContainer->layout() ); if( resizeLayout != NULL ) { resizeLayout->insertWidget( 1, resizeLabel ); } connect( resizeLabel, SIGNAL( dragging( QPoint ) ), this, SLOT( draggingSlot( QPoint ) ) ); connect( resizeLabel, SIGNAL( clicked() ), this, SIGNAL( resizeWidgetClicked() ) ); }
void QFStatusBar::addLabel() { //QList<QLabel*> lst = findChildren<QLabel*>(); //int ix = lst.count(); QBoxLayout *ly = qobject_cast<QBoxLayout*>(layout()); QF_ASSERT_EX(ly, "bad layout"); //ly->setMargin(0); QLabel *lbl = new QLabel(QString());//::number(labels.count())); lbl->setFrameStyle(QFrame::StyledPanel | QFrame::Plain); ly->insertWidget(labels.count(), lbl); labels << lbl; setProgressValue(-1); }
CommandButton* ChapterSelectUI::createRightNavigationButton() { CommandButton* button = new CommandButton( _ui->_rightNavigationContainer, Constants::CHAPTER_SELECT_IMAGE_DIR + Constants::CHAPTER_SELECT_RIGHT_ARROW_URL, Constants::CHAPTER_SELECT_ARROW_WIDTH, Constants::CHAPTER_SELECT_ARROW_HEIGHT ); button->setDisabledImage( Constants::CHAPTER_SELECT_IMAGE_DIR + Constants::CHAPTER_SELECT_RIGHT_ARROW_DISABLED_URL ); connect( button, SIGNAL( clicked() ), this, SLOT( onRightNavigationClicked() ) ); QBoxLayout *rightLayout = qobject_cast<QBoxLayout*>( _ui->_rightNavigationContainer->layout() ); if( rightLayout != NULL ) { rightLayout->insertWidget( 1, button ); } return button; }
/** Add a radio button to the plot options * * @param text :: text on the radio button * @param tooltip :: tooltip * @param bIntegrated :: flag to indicate that the dimension is integrated. */ void LinePlotOptions::addPlotRadioButton(const std::string &text, const std::string &tooltip, const bool bIntegrated) { QRadioButton *rad; rad = new QRadioButton(ui.widgetPlotAxis); rad->setText(QString::fromStdString(text)); rad->setToolTip(QString::fromStdString(tooltip)); rad->setEnabled(!bIntegrated); // Insert it one before the horizontal spacer. QBoxLayout *layout = qobject_cast<QBoxLayout *>(ui.widgetPlotAxis->layout()); layout->insertWidget(layout->count() - 1, rad); m_radPlots.push_back(rad); QObject::connect(rad, SIGNAL(toggled(bool)), this, SLOT(radPlot_changed())); }
void TDockWidget::setTitleBarWidget(QWidget *titlebar) { if (titlebar) { QBoxLayout *boxLayout = static_cast<QBoxLayout *>(layout()); if (m_titlebar && m_titlebar != titlebar) boxLayout->removeWidget(m_titlebar); boxLayout->insertWidget(0, titlebar); // Set top/left-aligned boxLayout->setAlignment( titlebar, getOrientation() == vertical ? Qt::AlignTop : Qt::AlignLeft); m_titlebar = titlebar; if (m_floating) setFloatingAppearance(); } }
void replaceWidget(QWidget *a, QWidget *b) { if(!a) return; QLayout *lo = rw_findLayoutOf(a); if(!lo) return; //printf("decided on this: %p\n", lo); if(lo->inherits("QBoxLayout")) { QBoxLayout *bo = (QBoxLayout *)lo; int n = bo->findWidget(a); bo->insertWidget(n+1, b); delete a; } }
void KatalogView::init(const QString& katName ) { m_katalogName = katName; initActions(); /////////////////////////////////////////////////////////////////// // set up a vertical layout box QWidget *w = new QWidget(this); QBoxLayout *box = new QVBoxLayout(w); // start to set up the listview createCentralWidget(box, w); KatalogListView *listview = getListView(); if( ! listview ) { // qDebug () << "ERROR: No listview created !!!" << endl; } else { m_filterHead = new FilterHeader(w, listview); box->insertWidget(0, m_filterHead); connect( listview, SIGNAL(currentItemChanged ( QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(slTreeviewItemChanged( QTreeWidgetItem*, QTreeWidgetItem*)) ); connect( listview, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(slEditTemplate())); connect( listview, SIGNAL(templateHoovered(CatalogTemplate*)), this, SLOT(slotShowTemplateDetails( CatalogTemplate*))); // Populate the context Menu (listview->contextMenu())->addAction( m_acEditItem ); (listview->contextMenu())->addAction( m_acNewItem ); (listview->contextMenu())->addAction( m_acDeleteItem ); (listview->contextMenu())->addSeparator(); (listview->contextMenu())->addAction( m_acAddChapter ); (listview->contextMenu())->addAction( m_acEditChapter ); (listview->contextMenu())->addAction( m_acRemChapter ); getKatalog( katName ); listview->addCatalogDisplay( katName ); } setCentralWidget(w); m_editListViewItem = 0; // qDebug () << "Getting katalog!" << katName << endl; setAutoSaveSettings( QString::fromLatin1( "CatalogWindow" ), true ); }
void SliderDialog::addSlider(CSlider* pSlider) { if (mpParentWindow == NULL) return; // check if there already is a slider for this object CCopasiDataModel * pDataModel = pSlider->getObjectDataModel(); assert(pDataModel != NULL); SCopasiXMLGUI* pGUI = pDataModel->getGUI(); assert(pGUI); if (!equivalentSliderExists(pSlider)) { CObjectInterface::ContainerList listOfContainers; assert(CCopasiRootContainer::getDatamodelList()->size() > 0); listOfContainers.push_back(pDataModel->getModel()); pSlider->compile(listOfContainers); pGUI->getSliderList()->add(pSlider, true); } CopasiSlider* tmp = findCopasiSliderForCSlider(pSlider); if (!tmp) { setCurrentSlider(new CopasiSlider(pSlider, mpParentWindow->getDataModel(), mpSliderBox)); mpCurrSlider->installEventFilter(this); mpCurrSlider->setHidden(true); mpCurrSlider->updateSliderData(); // make sure the slider points to the correct object // for the currently set framework this->setCorrectSliderObject(this->mpCurrSlider); mSliderMap[mCurrentFolderId].push_back(mpCurrSlider); QBoxLayout* layout = static_cast<QBoxLayout*>(mpSliderBox->layout()); int childCount = layout->count() - 1; layout->insertWidget(childCount, mpCurrSlider); connect(mpCurrSlider, SIGNAL(valueChanged(double)), this , SLOT(sliderValueChanged())); connect(mpCurrSlider, SIGNAL(sliderReleased()), this, SLOT(sliderReleased())); connect(mpCurrSlider, SIGNAL(sliderPressed()), this, SLOT(sliderPressed())); connect(mpCurrSlider, SIGNAL(closeClicked(CopasiSlider*)), this, SLOT(removeSlider(CopasiSlider*))); connect(mpCurrSlider, SIGNAL(editClicked(CopasiSlider*)), this, SLOT(editSlider(CopasiSlider*))); mpCurrSlider->setHidden(false); mChanged = true; }
ProxyError::ProxyError(ProxyPlugin *plugin, TCPClient *client, const QString& msg) : QDialog(NULL) , m_plugin(plugin) , m_client(client) { setupUi(this); setModal(false); setAttribute(Qt::WA_DeleteOnClose); setWindowIcon(Icon("error")); setButtonsPict(this); lblMessage->setText(msg); if (layout() && layout()->inherits("QBoxLayout")){ QBoxLayout *lay = static_cast<QBoxLayout*>(layout()); ProxyConfig *cfg = new ProxyConfig(this, m_plugin, NULL, static_cast <ClientPtr> (m_client)); lay->insertWidget(1, cfg); cfg->show(); setMinimumSize(sizeHint()); connect(this, SIGNAL(apply()), cfg, SLOT(apply())); } }
void HoveringButtonsController::AddButton(QPushButton *button) { button->setParent(this); button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); button->setMaximumHeight(30); button->setMaximumWidth(60); QFont font(button->font()); QRect rect = button->fontMetrics().tightBoundingRect(button->text()); qreal scale = (button->maximumWidth() - text_padding_)/rect.width(); font.setPointSize(font.pointSizeF() * scale); button->setFont(font); QBoxLayout* layout = dynamic_cast<QBoxLayout*>(this->layout()); if(!layout) return; layout->insertWidget(0,button); QObject::connect(button, SIGNAL(pressed()), this, SLOT(ButtonPressed())); button->show(); }
ProxyError::ProxyError(ProxyPlugin *plugin, TCPClient *client, const char *msg) : ProxyErrorBase(NULL, NULL, false, WDestructiveClose) { SET_WNDPROC("proxy") setIcon(Pict("error")); setButtonsPict(this); setCaption(caption()); m_plugin = plugin; m_client = client; if (msg && *msg) lblMessage->setText(i18n(msg)); if (layout() && layout()->inherits("QBoxLayout")){ QBoxLayout *lay = static_cast<QBoxLayout*>(layout()); ProxyConfig *cfg = new ProxyConfig(this, m_plugin, NULL, m_client); lay->insertWidget(1, cfg); cfg->show(); setMinimumSize(sizeHint()); connect(this, SIGNAL(apply()), cfg, SLOT(apply())); } }
void ContentsDialog::setCheckBox(const QString &text, bool state) { if (!m_checkBox) { QBoxLayout *mainLayout = static_cast<QBoxLayout*>(layout()); if (!mainLayout) { return; } m_checkBox = new QCheckBox(this); mainLayout->insertWidget((mainLayout->count() - 1), m_checkBox); } m_checkBox->setText(text); m_checkBox->setChecked(state); adjustSize(); }
void ProgressFrame::addToButtonBox(QDialogButtonBox *button_box, QObject *main_window) { // We have a ProgressFrame in the main status bar which is controlled // from the capture file and other parts of the application via // create_progress_dlg and delayed_create_progress_dlg. // Create a new ProgressFrame and pair it with the main instance. ProgressFrame *main_progress_frame = main_window->findChild<ProgressFrame *>(); if (!button_box || !main_progress_frame) return; QBoxLayout *layout = qobject_cast<QBoxLayout *>(button_box->layout()); if (!layout) return; ProgressFrame *progress_frame = new ProgressFrame(button_box); // Insert ourselves after the first spacer we find, otherwise the // far right of the button box. int idx = layout->count(); for (int i = 0; i < layout->count(); i++) { if (layout->itemAt(i)->spacerItem()) { idx = i + 1; break; } } layout->insertWidget(idx, progress_frame); int one_em = progress_frame->fontMetrics().height(); progress_frame->setMaximumWidth(one_em * 8); connect(main_progress_frame, SIGNAL(showRequested(bool,bool,gboolean*)), progress_frame, SLOT(show(bool,bool,gboolean*))); connect(main_progress_frame, SIGNAL(maximumValueChanged(int)), progress_frame, SLOT(setMaximumValue(int))); connect(main_progress_frame, SIGNAL(valueChanged(int)), progress_frame, SLOT(setValue(int))); connect(main_progress_frame, SIGNAL(setHidden()), progress_frame, SLOT(hide())); connect(progress_frame, SIGNAL(stopLoading()), main_progress_frame, SIGNAL(stopLoading())); }
void RatingWidget::init() { updateBounds(); m_total = qMin(m_max, static_cast<int>(m_widgets.count())); int i = 0; for( ; i < m_total; ++i) { m_widgets.at(i)->setPixmap(m_pixOff); } setUpdatesEnabled(false); QBoxLayout* l = ::qobject_cast<QBoxLayout*>(layout()); // move the clear button to right after the last star l->removeWidget(m_clearButton); l->insertWidget(i, m_clearButton); l->removeItem(m_clearSpacer); l->insertSpacerItem(i+1, m_clearSpacer); m_clearButton->hide(); setUpdatesEnabled(true); for( ; i < m_widgets.count(); ++i) { m_widgets.at(i)->setPixmap(QPixmap()); } update(); }
DlgAutoDJ::DlgAutoDJ(QWidget* parent, ConfigObject<ConfigValue>* pConfig, AutoDJProcessor* pProcessor, TrackCollection* pTrackCollection, MixxxKeyboard* pKeyboard) : QWidget(parent), Ui::DlgAutoDJ(), m_pAutoDJProcessor(pProcessor), // no sorting m_pTrackTableView(new WTrackTableView(this, pConfig, pTrackCollection, false)), m_pAutoDJTableModel(NULL) { setupUi(this); m_pTrackTableView->installEventFilter(pKeyboard); connect(m_pTrackTableView, SIGNAL(loadTrack(TrackPointer)), this, SIGNAL(loadTrack(TrackPointer))); connect(m_pTrackTableView, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool)), this, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool))); connect(m_pTrackTableView, SIGNAL(trackSelected(TrackPointer)), this, SIGNAL(trackSelected(TrackPointer))); QBoxLayout* box = dynamic_cast<QBoxLayout*>(layout()); Q_ASSERT(box); //Assumes the form layout is a QVBox/QHBoxLayout! box->removeWidget(m_pTrackTablePlaceholder); m_pTrackTablePlaceholder->hide(); box->insertWidget(1, m_pTrackTableView); // We do _NOT_ take ownership of this from AutoDJProcessor. m_pAutoDJTableModel = m_pAutoDJProcessor->getTableModel(); m_pTrackTableView->loadTrackModel(m_pAutoDJTableModel); // Override some playlist-view properties: // Do not set this because it disables auto-scrolling //m_pTrackTableView->setDragDropMode(QAbstractItemView::InternalMove); connect(pushButtonShuffle, SIGNAL(clicked(bool)), this, SLOT(shufflePlaylistButton(bool))); connect(pushButtonSkipNext, SIGNAL(clicked(bool)), this, SLOT(skipNextButton(bool))); #ifdef __AUTODJCRATES__ connect(pushButtonAddRandom, SIGNAL(clicked(bool)), this, SIGNAL(addRandomButton(bool))); #else // __AUTODJCRATES__ pushButtonAddRandom->setVisible(false); horizontalLayout->removeWidget(pushButtonAddRandom); #endif // __AUTODJCRATES__ connect(pushButtonFadeNow, SIGNAL(clicked(bool)), this, SLOT(fadeNowButton(bool))); connect(spinBoxTransition, SIGNAL(valueChanged(int)), this, SLOT(transitionSliderChanged(int))); connect(pushButtonAutoDJ, SIGNAL(toggled(bool)), this, SLOT(toggleAutoDJButton(bool))); // Setup DlgAutoDJ UI based on the current AutoDJProcessor state. Keep in // mind that AutoDJ may already be active when DlgAutoDJ is created (due to // skin changes, etc.). spinBoxTransition->setValue(m_pAutoDJProcessor->getTransitionTime()); connect(m_pAutoDJProcessor, SIGNAL(transitionTimeChanged(int)), this, SLOT(transitionTimeChanged(int))); connect(m_pAutoDJProcessor, SIGNAL(autoDJStateChanged(AutoDJProcessor::AutoDJState)), this, SLOT(autoDJStateChanged(AutoDJProcessor::AutoDJState))); autoDJStateChanged(m_pAutoDJProcessor->getState()); }