SpeedDial::SpeedDial(QWidget* parent) : QGroupBox(parent) , m_timer(new QTimer(this)) , m_dial(NULL) , m_hrs(NULL) , m_min(NULL) , m_sec(NULL) , m_ms(NULL) , m_focus(NULL) , m_previousDialValue(0) , m_preventSignals(false) , m_value(0) , m_tapTick(false) , m_tapTime(NULL) , m_tapTickTimer(NULL) , m_tapTickElapseTimer(NULL) , m_visibilityMask(DEFAULT_VISIBILITY_MASK) { new QVBoxLayout(this); layout()->setSpacing(0); layout()->setMargin(2); QHBoxLayout* topHBox = new QHBoxLayout(); QVBoxLayout* pmVBox1 = new QVBoxLayout(); QVBoxLayout* taVBox3 = new QVBoxLayout(); layout()->addItem(topHBox); m_plus = new QToolButton(this); m_plus->setIconSize(QSize(32, 32)); m_plus->setIcon(QIcon(":/edit_add.png")); pmVBox1->addWidget(m_plus, Qt::AlignVCenter | Qt::AlignLeft); connect(m_plus, SIGNAL(pressed()), this, SLOT(slotPlusMinus())); connect(m_plus, SIGNAL(released()), this, SLOT(slotPlusMinus())); m_minus = new QToolButton(this); m_minus->setIconSize(QSize(32, 32)); m_minus->setIcon(QIcon(":/edit_remove.png")); pmVBox1->addWidget(m_minus, Qt::AlignVCenter | Qt::AlignLeft); connect(m_minus, SIGNAL(pressed()), this, SLOT(slotPlusMinus())); connect(m_minus, SIGNAL(released()), this, SLOT(slotPlusMinus())); topHBox->addItem(pmVBox1); m_dial = new QDial(this); m_dial->setWrapping(true); m_dial->setNotchesVisible(true); m_dial->setNotchTarget(15); m_dial->setTracking(true); topHBox->addWidget(m_dial); connect(m_dial, SIGNAL(valueChanged(int)), this, SLOT(slotDialChanged(int))); m_tap = new QPushButton(tr("Tap"), this); m_tap->setStyleSheet(tapDefaultSS); m_tap->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); taVBox3->addWidget(m_tap); connect(m_tap, SIGNAL(clicked()), this, SLOT(slotTapClicked())); topHBox->addItem (taVBox3); QHBoxLayout* timeHBox = new QHBoxLayout(); layout()->addItem(timeHBox); m_hrs = new FocusSpinBox(this); m_hrs->setRange(0, HRS_MAX); m_hrs->setSuffix("h"); m_hrs->setButtonSymbols(QSpinBox::NoButtons); m_hrs->setToolTip(tr("Hours")); timeHBox->addWidget(m_hrs); connect(m_hrs, SIGNAL(valueChanged(int)), this, SLOT(slotHoursChanged())); connect(m_hrs, SIGNAL(focusGained()), this, SLOT(slotSpinFocusGained())); m_min = new FocusSpinBox(this); m_min->setRange(0, MIN_MAX); m_min->setSuffix("m"); m_min->setButtonSymbols(QSpinBox::NoButtons); m_min->setToolTip(tr("Minutes")); timeHBox->addWidget(m_min); connect(m_min, SIGNAL(valueChanged(int)), this, SLOT(slotMinutesChanged())); connect(m_min, SIGNAL(focusGained()), this, SLOT(slotSpinFocusGained())); m_sec = new FocusSpinBox(this); m_sec->setRange(0, SEC_MAX); m_sec->setSuffix("s"); m_sec->setButtonSymbols(QSpinBox::NoButtons); m_sec->setToolTip(tr("Seconds")); timeHBox->addWidget(m_sec); connect(m_sec, SIGNAL(valueChanged(int)), this, SLOT(slotSecondsChanged())); connect(m_sec, SIGNAL(focusGained()), this, SLOT(slotSpinFocusGained())); m_ms = new FocusSpinBox(this); m_ms->setRange(0, MS_MAX); m_ms->setSuffix("ms"); m_ms->setButtonSymbols(QSpinBox::NoButtons); m_ms->setToolTip(tr("Milliseconds")); timeHBox->addWidget(m_ms); connect(m_ms, SIGNAL(valueChanged(int)), this, SLOT(slotMSChanged())); connect(m_ms, SIGNAL(focusGained()), this, SLOT(slotSpinFocusGained())); m_infiniteCheck = new QCheckBox(this); m_infiniteCheck->setText(tr("Infinite")); layout()->addWidget(m_infiniteCheck); connect(m_infiniteCheck, SIGNAL(toggled(bool)), this, SLOT(slotInfiniteChecked(bool))); m_focus = m_ms; m_dial->setRange(m_focus->minimum(), m_focus->maximum()); m_dial->setSingleStep(m_focus->singleStep()); m_timer->setInterval(TIMER_HOLD); connect(m_timer, SIGNAL(timeout()), this, SLOT(slotPlusMinusTimeout())); m_tapTickElapseTimer = new QTimer(); #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) m_tapTickElapseTimer->setTimerType(Qt::PreciseTimer); #endif m_tapTickElapseTimer->setSingleShot(true); connect(m_tapTickElapseTimer, SIGNAL(timeout()), this, SLOT(slotTapTimeout())); //Hide elements according to current visibility mask setVisibilityMask(m_visibilityMask); }
transferOrderList::transferOrderList( QWidget* parent, const char* name, bool modal, Qt::WFlags fl ) : QDialog(parent, fl) { setObjectName(name ? name : "transferOrderList"); setModal(modal); _toheadid = -1; _type = (cToOpen | cToClosed); setWindowTitle(tr("Transfer Orders")); QVBoxLayout *mainLayout = new QVBoxLayout(this); QHBoxLayout *warehouseLayout = new QHBoxLayout(0); QHBoxLayout *topLayout = new QHBoxLayout(0); QVBoxLayout *buttonsLayout = new QVBoxLayout(0); QVBoxLayout *listLayout = new QVBoxLayout(0); mainLayout->setContentsMargins(5, 5, 5, 5); warehouseLayout->setContentsMargins(0, 0, 0, 0); topLayout->setContentsMargins(0, 0, 0, 0); buttonsLayout->setContentsMargins(0, 0, 0, 0); listLayout->setContentsMargins(0, 0, 0, 0); mainLayout->setSpacing(5); warehouseLayout->setSpacing(0); topLayout->setSpacing(7); buttonsLayout->setSpacing(5); listLayout->setSpacing(0); _srcwhs = new WarehouseGroup(this, "_srcwhs"); _srcwhs->setTitle(tr("From Site:")); _dstwhs = new WarehouseGroup(this, "_dstwhs"); _dstwhs->setTitle(tr("To Site:")); _dstwhs->setAll(); warehouseLayout->addWidget(_srcwhs); warehouseLayout->addWidget(_dstwhs); QSpacerItem* spacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Preferred); warehouseLayout->addItem(spacer); topLayout->addLayout(warehouseLayout); QSpacerItem* spacer_2 = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); topLayout->addItem(spacer_2); _close = new QPushButton(tr("&Cancel"), this); _close->setObjectName("_close"); buttonsLayout->addWidget(_close); _select = new QPushButton(tr("&Select"), this); _select->setObjectName("_select"); _select->setEnabled( FALSE ); _select->setDefault( TRUE ); buttonsLayout->addWidget(_select); topLayout->addLayout(buttonsLayout); mainLayout->addLayout(topLayout); QLabel *_transferOrdersLit = new QLabel(tr("Transfer Orders:"), this); _transferOrdersLit->setObjectName("_transferOrdersLit"); listLayout->addWidget(_transferOrdersLit); _to = new XTreeWidget(this); _to->setObjectName("_to"); listLayout->addWidget(_to); mainLayout->addLayout(listLayout); resize( QSize(490, 390).expandedTo(minimumSizeHint()) ); connect(_close, SIGNAL(clicked()), this, SLOT( reject() ) ); connect(_dstwhs, SIGNAL(updated()), this, SLOT( sFillList() ) ); connect(_select, SIGNAL(clicked()), this, SLOT( sSelect() ) ); connect(_srcwhs, SIGNAL(updated()), this, SLOT( sFillList() ) ); connect(_to, SIGNAL(valid(bool)), _select, SLOT( setEnabled(bool) ) ); connect(_to, SIGNAL(itemSelected(int)), _select, SLOT( animateClick() ) ); _to->addColumn(tr("Order #"), _orderColumn, Qt::AlignLeft, true, "tohead_number"); _to->addColumn(tr("From Whs."), -1, Qt::AlignLeft, true, "tohead_srcname"); _to->addColumn(tr("To Whs."), _orderColumn, Qt::AlignLeft, true, "tohead_destname"); _to->addColumn(tr("Ordered"), _dateColumn, Qt::AlignCenter, true, "tohead_orderdate"); _to->addColumn(tr("Scheduled"),_dateColumn, Qt::AlignCenter,true, "scheddate"); setTabOrder(_srcwhs, _dstwhs); setTabOrder(_dstwhs, _to); setTabOrder(_to, _select); setTabOrder(_select, _close); setTabOrder(_close, _srcwhs); _srcwhs->setFocus(); }
QgsRelationEditorWidget::QgsRelationEditorWidget( QWidget* parent ) : QgsCollapsibleGroupBox( parent ) , mViewMode( QgsDualView::AttributeEditor ) , mVisible( false ) { QVBoxLayout* topLayout = new QVBoxLayout( this ); topLayout->setContentsMargins( 0, 9, 0, 0 ); setLayout( topLayout ); // buttons QHBoxLayout* buttonLayout = new QHBoxLayout(); buttonLayout->setContentsMargins( 0, 0, 0, 0 ); // toogle editing mToggleEditingButton = new QToolButton( this ); mToggleEditingButton->setObjectName( "mToggleEditingButton" ); mToggleEditingButton->setIcon( QgsApplication::getThemeIcon( "/mActionToggleEditing.svg" ) ); mToggleEditingButton->setText( tr( "Toggle editing" ) ); mToggleEditingButton->setEnabled( false ); mToggleEditingButton->setCheckable( true ); mToggleEditingButton->setToolTip( tr( "Toggle editing mode for child layer" ) ); buttonLayout->addWidget( mToggleEditingButton ); // save Edits mSaveEditsButton = new QToolButton( this ); mSaveEditsButton->setIcon( QgsApplication::getThemeIcon( "/mActionSaveEdits.svg" ) ); mSaveEditsButton->setText( tr( "Save child layer edits" ) ); mSaveEditsButton->setToolTip( tr( "Save child layer edits" ) ); mSaveEditsButton->setEnabled( true ); buttonLayout->addWidget( mSaveEditsButton ); // add feature mAddFeatureButton = new QToolButton( this ); mAddFeatureButton->setIcon( QgsApplication::getThemeIcon( "/mActionNewTableRow.svg" ) ); mAddFeatureButton->setText( tr( "Add child feature" ) ); mAddFeatureButton->setToolTip( tr( "Add child feature" ) ); mAddFeatureButton->setObjectName( "mAddFeatureButton" ); buttonLayout->addWidget( mAddFeatureButton ); // delete feature mDeleteFeatureButton = new QToolButton( this ); mDeleteFeatureButton->setIcon( QgsApplication::getThemeIcon( "/mActionDeleteSelected.svg" ) ); mDeleteFeatureButton->setText( tr( "Delete child feature" ) ); mDeleteFeatureButton->setToolTip( tr( "Delete child feature" ) ); mDeleteFeatureButton->setObjectName( "mDeleteFeatureButton" ); buttonLayout->addWidget( mDeleteFeatureButton ); // link feature mLinkFeatureButton = new QToolButton( this ); mLinkFeatureButton->setIcon( QgsApplication::getThemeIcon( "/mActionLink.svg" ) ); mLinkFeatureButton->setText( tr( "Link existing features" ) ); mLinkFeatureButton->setToolTip( tr( "Link existing child features" ) ); mLinkFeatureButton->setObjectName( "mLinkFeatureButton" ); buttonLayout->addWidget( mLinkFeatureButton ); // unlink feature mUnlinkFeatureButton = new QToolButton( this ); mUnlinkFeatureButton->setIcon( QgsApplication::getThemeIcon( "/mActionUnlink.svg" ) ); mUnlinkFeatureButton->setText( tr( "Unlink feature" ) ); mUnlinkFeatureButton->setToolTip( tr( "Unlink child feature" ) ); mUnlinkFeatureButton->setObjectName( "mUnlinkFeatureButton" ); buttonLayout->addWidget( mUnlinkFeatureButton ); // spacer buttonLayout->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding ) ); // form view mFormViewButton = new QToolButton( this ); mFormViewButton->setText( tr( "Form view" ) ); mFormViewButton->setToolTip( tr( "Switch to form view" ) ); mFormViewButton->setIcon( QgsApplication::getThemeIcon( "/mActionPropertyItem.png" ) ); mFormViewButton->setCheckable( true ); mFormViewButton->setChecked( mViewMode == QgsDualView::AttributeEditor ); buttonLayout->addWidget( mFormViewButton ); // table view mTableViewButton = new QToolButton( this ); mTableViewButton->setText( tr( "Table view" ) ); mTableViewButton->setToolTip( tr( "Switch to table view" ) ); mTableViewButton->setIcon( QgsApplication::getThemeIcon( "/mActionOpenTable.svg" ) ); mTableViewButton->setCheckable( true ); mTableViewButton->setChecked( mViewMode == QgsDualView::AttributeTable ); buttonLayout->addWidget( mTableViewButton ); // button group mViewModeButtonGroup = new QButtonGroup( this ); mViewModeButtonGroup->addButton( mFormViewButton, QgsDualView::AttributeEditor ); mViewModeButtonGroup->addButton( mTableViewButton, QgsDualView::AttributeTable ); // add buttons layout topLayout->addLayout( buttonLayout ); mRelationLayout = new QGridLayout(); mRelationLayout->setContentsMargins( 0, 0, 0, 0 ); topLayout->addLayout( mRelationLayout ); mDualView = new QgsDualView( this ); mDualView->setView( mViewMode ); mFeatureSelectionMgr = new QgsGenericFeatureSelectionManager( mDualView ); mDualView->setFeatureSelectionManager( mFeatureSelectionMgr ); mRelationLayout->addWidget( mDualView ); connect( this, SIGNAL( collapsedStateChanged( bool ) ), this, SLOT( onCollapsedStateChanged( bool ) ) ); connect( mViewModeButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( setViewMode( int ) ) ); connect( mToggleEditingButton, SIGNAL( clicked( bool ) ), this, SLOT( toggleEditing( bool ) ) ); connect( mSaveEditsButton, SIGNAL( clicked() ), this, SLOT( saveEdits() ) ); connect( mAddFeatureButton, SIGNAL( clicked() ), this, SLOT( addFeature() ) ); connect( mDeleteFeatureButton, SIGNAL( clicked() ), this, SLOT( deleteFeature() ) ); connect( mLinkFeatureButton, SIGNAL( clicked() ), this, SLOT( linkFeature() ) ); connect( mUnlinkFeatureButton, SIGNAL( clicked() ), this, SLOT( unlinkFeature() ) ); connect( mFeatureSelectionMgr, SIGNAL( selectionChanged( QgsFeatureIds, QgsFeatureIds, bool ) ), this, SLOT( updateButtons() ) ); // Set initial state for add/remove etc. buttons updateButtons(); }
// --------------- QDesignerPromotionDialog QDesignerPromotionDialog::QDesignerPromotionDialog(QDesignerFormEditorInterface *core, QWidget *parent, const QString &promotableWidgetClassName, QString *promoteTo) : QDialog(parent), m_mode(promotableWidgetClassName.isEmpty() || promoteTo == 0 ? ModeEdit : ModeEditChooseClass), m_promotableWidgetClassName(promotableWidgetClassName), m_core(core), m_promoteTo(promoteTo), m_promotion(core->promotion()), m_model(new PromotionModel(core)), m_treeView(new QTreeView), m_buttonBox(0), m_removeButton(new QPushButton(createIconSet(QString::fromUtf8("minus.png")), QString())) { m_buttonBox = createButtonBox(); setModal(true); setWindowTitle(tr("Promoted Widgets")); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); QVBoxLayout *vboxLayout = new QVBoxLayout(this); // tree view group QGroupBox *treeViewGroup = new QGroupBox(); treeViewGroup->setTitle(tr("Promoted Classes")); QVBoxLayout *treeViewVBoxLayout = new QVBoxLayout(treeViewGroup); // tree view m_treeView->setModel (m_model); m_treeView->setMinimumWidth(450); m_treeView->setContextMenuPolicy(Qt::CustomContextMenu); connect(m_treeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(slotSelectionChanged(QItemSelection,QItemSelection))); connect(m_treeView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotTreeViewContextMenu(QPoint))); QHeaderView *headerView = m_treeView->header(); headerView->setResizeMode(QHeaderView::ResizeToContents); treeViewVBoxLayout->addWidget(m_treeView); // remove button QHBoxLayout *hboxLayout = new QHBoxLayout(); hboxLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Ignored)); m_removeButton->setAutoDefault(false); connect(m_removeButton, SIGNAL(clicked()), this, SLOT(slotRemove())); m_removeButton->setEnabled(false); hboxLayout->addWidget(m_removeButton); treeViewVBoxLayout->addLayout(hboxLayout); vboxLayout->addWidget(treeViewGroup); // Create new panel: Try to be smart and preselect a base class. Default to QFrame const QStringList &baseClassNameList = baseClassNames(m_promotion); int preselectedBaseClass = -1; if (m_mode == ModeEditChooseClass) { preselectedBaseClass = baseClassNameList.indexOf(m_promotableWidgetClassName); } if (preselectedBaseClass == -1) preselectedBaseClass = baseClassNameList.indexOf(QLatin1String("QFrame")); NewPromotedClassPanel *newPromotedClassPanel = new NewPromotedClassPanel(baseClassNameList, preselectedBaseClass); newPromotedClassPanel->setPromotedHeaderSuffix(core->integration()->headerSuffix()); newPromotedClassPanel->setPromotedHeaderLowerCase(core->integration()->isHeaderLowercase()); connect(newPromotedClassPanel, SIGNAL(newPromotedClass(PromotionParameters,bool*)), this, SLOT(slotNewPromotedClass(PromotionParameters,bool*))); connect(this, SIGNAL(selectedBaseClassChanged(QString)), newPromotedClassPanel, SLOT(chooseBaseClass(QString))); vboxLayout->addWidget(newPromotedClassPanel); // button box vboxLayout->addWidget(m_buttonBox); // connect model connect(m_model, SIGNAL(includeFileChanged(QDesignerWidgetDataBaseItemInterface*,QString)), this, SLOT(slotIncludeFileChanged(QDesignerWidgetDataBaseItemInterface*,QString))); connect(m_model, SIGNAL(classNameChanged(QDesignerWidgetDataBaseItemInterface*,QString)), this, SLOT(slotClassNameChanged(QDesignerWidgetDataBaseItemInterface*,QString))); // focus if (m_mode == ModeEditChooseClass) newPromotedClassPanel->grabFocus(); slotUpdateFromWidgetDatabase(); }
void RoutingWidget::createButtons() { QHBoxLayout *hbox = new QHBoxLayout(RoutingWidgetLayout); pbRoutingNormal = new QPushButton(this); pbRoutingNormal->setIconSet(QIconSet(QPixmap((const char**)routing_normal))); hbox->addWidget(pbRoutingNormal); pbRoutingNormal->setToggleButton(true); pbRoutingFX = new QPushButton(this); pbRoutingFX->setIconSet(QIconSet(QPixmap((const char**)routing_fx))); hbox->addWidget(pbRoutingFX); pbRoutingFX->setToggleButton(true); pbRoutingIn = new QPushButton(this); pbRoutingIn->setIconSet(QIconSet(QPixmap((const char**)routing_in))); hbox->addWidget(pbRoutingIn); pbRoutingIn->setToggleButton(true); pbRoutingOut = new QPushButton(this); pbRoutingOut->setIconSet(QIconSet(QPixmap((const char**)routing_out))); hbox->addWidget(pbRoutingOut); pbRoutingOut->setToggleButton(true); pbRoutingRoute = new QPushButton(this); pbRoutingRoute->setIconSet(QIconSet(QPixmap((const char**)routing_route))); hbox->addWidget(pbRoutingRoute); pbRoutingRoute->setToggleButton(true); pbRoutingEffect = new QPushButton(this); pbRoutingEffect->setIconSet(QIconSet(QPixmap((const char**)routing_effect))); hbox->addWidget(pbRoutingEffect); pbRoutingEffect->setToggleButton(true); pbRoutingEffectStack = new QPushButton(this); pbRoutingEffectStack->setIconSet(QIconSet(QPixmap((const char**)routing_effect_stack))); hbox->addWidget(pbRoutingEffectStack); pbRoutingEffectStack->setToggleButton(true); pbRoutingEffectStack->hide(); QSpacerItem *spacer1 = new QSpacerItem(10, 0, QSizePolicy::Minimum, QSizePolicy::Minimum); hbox->addItem(spacer1); QPushButton *pbRoutingZoomPlus = new QPushButton(this); pbRoutingZoomPlus->setIconSet(QIconSet(QPixmap((const char**)routing_zoom_plus))); hbox->addWidget(pbRoutingZoomPlus); sbRoutingZoom = new QSpinBox(this); hbox->addWidget(sbRoutingZoom); sbRoutingZoom->setMinValue(10); sbRoutingZoom->setMaxValue(500); QPushButton *pbRoutingZoomMinus = new QPushButton(this); pbRoutingZoomMinus->setIconSet(QIconSet(QPixmap((const char**)routing_zoom_minus))); hbox->addWidget(pbRoutingZoomMinus); QSpacerItem *spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); hbox->addItem(spacer); connect(pbRoutingNormal, SIGNAL(clicked()), this, SLOT(modeNormalClicked())); connect(pbRoutingFX, SIGNAL(clicked()), this, SLOT(modeFxClicked())); connect(pbRoutingIn, SIGNAL(clicked()), this, SLOT(modeInClicked())); connect(pbRoutingOut, SIGNAL(clicked()), this, SLOT(modeOutClicked())); connect(pbRoutingRoute, SIGNAL(clicked()), this, SLOT(modeRouteClicked())); connect(pbRoutingEffect, SIGNAL(clicked()), this, SLOT(modeEffectClicked())); connect(pbRoutingEffectStack, SIGNAL(clicked()), this, SLOT(modeEffectStackClicked())); connect(sbRoutingZoom, SIGNAL(valueChanged(int)), this, SLOT(zoomValueChanged(int))); connect(pbRoutingZoomMinus, SIGNAL(clicked()), this, SLOT(zoomOutClicked())); connect(pbRoutingZoomPlus, SIGNAL(clicked()), this, SLOT(zoomInClicked())); }
QT_BEGIN_NAMESPACE FindWidget::FindWidget(QWidget *parent) : QWidget(parent) , appPalette(qApp->palette()) { TRACE_OBJ installEventFilter(this); QHBoxLayout *hboxLayout = new QHBoxLayout(this); QString resourcePath = QLatin1String(":/trolltech/assistant/images/"); #ifndef Q_OS_MAC hboxLayout->setMargin(0); hboxLayout->setSpacing(6); resourcePath.append(QLatin1String("win")); #else resourcePath.append(QLatin1String("mac")); #endif toolClose = setupToolButton(QLatin1String(""), resourcePath + QLatin1String("/closetab.png")); hboxLayout->addWidget(toolClose); connect(toolClose, SIGNAL(clicked()), SLOT(hide())); editFind = new QLineEdit(this); hboxLayout->addWidget(editFind); editFind->setMinimumSize(QSize(150, 0)); connect(editFind, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString))); connect(editFind, SIGNAL(returnPressed()), this, SIGNAL(findNext())); connect(editFind, SIGNAL(textChanged(QString)), this, SLOT(updateButtons())); toolPrevious = setupToolButton(tr("Previous"), resourcePath + QLatin1String("/previous.png")); connect(toolPrevious, SIGNAL(clicked()), this, SIGNAL(findPrevious())); hboxLayout->addWidget(toolPrevious); toolNext = setupToolButton(tr("Next"), resourcePath + QLatin1String("/next.png")); hboxLayout->addWidget(toolNext); connect(toolNext, SIGNAL(clicked()), this, SIGNAL(findNext())); checkCase = new QCheckBox(tr("Case Sensitive"), this); hboxLayout->addWidget(checkCase); labelWrapped = new QLabel(this); labelWrapped->setScaledContents(true); labelWrapped->setTextFormat(Qt::RichText); labelWrapped->setMinimumSize(QSize(0, 20)); labelWrapped->setMaximumSize(QSize(105, 20)); labelWrapped->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter); labelWrapped->setText(tr("<img src=\":/trolltech/assistant/images/wrap.png\"" "> Search wrapped")); hboxLayout->addWidget(labelWrapped); QSpacerItem *spacerItem = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); hboxLayout->addItem(spacerItem); setMinimumWidth(minimumSizeHint().width()); labelWrapped->hide(); updateButtons(); }
Radio::Radio() { radio = new QRadioTuner; connect(radio,SIGNAL(frequencyChanged(int)),this,SLOT(freqChanged(int))); connect(radio,SIGNAL(signalStrengthChanged(int)),this,SLOT(signalChanged(int))); connect(radio, SIGNAL(error(QRadioTuner::Error)), this, SLOT(error(QRadioTuner::Error))); if(radio->isBandSupported(QRadioTuner::FM)) radio->setBand(QRadioTuner::FM); QWidget *window = new QWidget; QVBoxLayout* layout = new QVBoxLayout; QHBoxLayout* buttonBar = new QHBoxLayout; #if defined Q_OS_SYMBIAN // this is so that we can see all buttons also in 3.1 devices, where the screens are smaller.. QHBoxLayout* buttonBar2 = new QHBoxLayout; #endif QHBoxLayout* topBar = new QHBoxLayout; layout->addLayout(topBar); freq = new QLabel; freq->setText(QString("%1 kHz").arg(radio->frequency()/1000)); topBar->addWidget(freq); signal = new QLabel; if (radio->isAvailable()) signal->setText(tr("No Signal")); else signal->setText(tr("No radio found")); topBar->addWidget(signal); #if defined Q_WS_MAEMO_5 QSpacerItem *spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); topBar->addItem(spacer); volumeSlider = new QSlider(Qt::Horizontal,this); #else volumeSlider = new QSlider(Qt::Vertical,this); #endif volumeSlider->setRange(0,100); volumeSlider->setValue(50); connect(volumeSlider,SIGNAL(valueChanged(int)),this,SLOT(updateVolume(int))); topBar->addWidget(volumeSlider); layout->addLayout(buttonBar); #if defined Q_OS_SYMBIAN layout->addLayout(buttonBar2); #endif searchLeft = new QPushButton; searchLeft->setText(tr("scan Down")); connect(searchLeft,SIGNAL(clicked()),SLOT(searchDown())); buttonBar->addWidget(searchLeft); left = new QPushButton; left->setText(tr("Freq Down")); connect(left,SIGNAL(clicked()),SLOT(freqDown())); #if defined Q_OS_SYMBIAN buttonBar2->addWidget(left); #else buttonBar->addWidget(left); #endif right = new QPushButton; connect(right,SIGNAL(clicked()),SLOT(freqUp())); right->setText(tr("Freq Up")); #if defined Q_OS_SYMBIAN buttonBar2->addWidget(right); #else buttonBar->addWidget(right); #endif searchRight = new QPushButton; searchRight->setText(tr("scan Up")); connect(searchRight,SIGNAL(clicked()),SLOT(searchUp())); buttonBar->addWidget(searchRight); window->setLayout(layout); setCentralWidget(window); window->show(); radio->start(); }
/** * Sets up the page. */ void ActivityPage::setupPage() { int margin = fontMetrics().height(); QVBoxLayout * mainLayout = new QVBoxLayout(this); mainLayout->setSpacing(10); m_pActivityGB = new QGroupBox(i18n("Activities"), this); // vertical box layout for the activity lists, arrow buttons and the button box QVBoxLayout* listVBoxLayout = new QVBoxLayout(m_pActivityGB); listVBoxLayout->setMargin(margin); listVBoxLayout->setSpacing(10); //horizontal box contains the list box and the move up/down buttons QHBoxLayout* listHBoxLayout = new QHBoxLayout(); listHBoxLayout->setSpacing(10); listVBoxLayout->addItem(listHBoxLayout); m_pActivityLW = new QListWidget(m_pActivityGB); m_pActivityLW->setContextMenuPolicy(Qt::CustomContextMenu); listHBoxLayout->addWidget(m_pActivityLW); QVBoxLayout * buttonLayout = new QVBoxLayout(); listHBoxLayout->addItem(buttonLayout); m_pTopArrowB = new QToolButton(m_pActivityGB); m_pTopArrowB->setArrowType(Qt::UpArrow); m_pTopArrowB->setEnabled(false); m_pTopArrowB->setToolTip(i18n("Move selected item to the top")); buttonLayout->addWidget(m_pTopArrowB); m_pUpArrowB = new QToolButton(m_pActivityGB); m_pUpArrowB->setArrowType(Qt::UpArrow); m_pUpArrowB->setEnabled(false); m_pUpArrowB->setToolTip(i18n("Move selected item up")); buttonLayout->addWidget(m_pUpArrowB); m_pDownArrowB = new QToolButton(m_pActivityGB); m_pDownArrowB->setArrowType(Qt::DownArrow); m_pDownArrowB->setEnabled(false); m_pDownArrowB->setToolTip(i18n("Move selected item down")); buttonLayout->addWidget(m_pDownArrowB); m_pBottomArrowB = new QToolButton(m_pActivityGB); m_pBottomArrowB->setArrowType(Qt::DownArrow); m_pBottomArrowB->setEnabled(false); m_pBottomArrowB->setToolTip(i18n("Move selected item to the bottom")); buttonLayout->addWidget(m_pBottomArrowB); #if QT_VERSION >= 0x050000 QDialogButtonBox* buttonBox = new QDialogButtonBox(m_pActivityGB); QPushButton* newActivity = buttonBox->addButton(i18n("New Activity..."), QDialogButtonBox::ActionRole); connect(newActivity, SIGNAL(clicked()), this, SLOT(slotNewActivity())); m_pDeleteActivityButton = buttonBox->addButton(i18n("Delete"), QDialogButtonBox::ActionRole); connect(m_pDeleteActivityButton, SIGNAL(clicked()), this, SLOT(slotDelete())); m_pRenameButton = buttonBox->addButton(i18n("Rename"), QDialogButtonBox::ActionRole); connect(m_pRenameButton, SIGNAL(clicked()), this, SLOT(slotRename())); #else KDialogButtonBox* buttonBox = new KDialogButtonBox(m_pActivityGB); buttonBox->addButton(i18n("New Activity..."), KDialogButtonBox::ActionRole, this, SLOT(slotNewActivity())); m_pDeleteActivityButton = buttonBox->addButton(i18n("Delete"), KDialogButtonBox::ActionRole, this, SLOT(slotDelete())); m_pRenameButton = buttonBox->addButton(i18n("Rename"), KDialogButtonBox::ActionRole, this, SLOT(slotRename())); #endif listVBoxLayout->addWidget(buttonBox); mainLayout->addWidget(m_pActivityGB); //now fill activity list box QStringList list = m_pStateWidget->activities(); QStringList::ConstIterator end(list.end()); for(QStringList::ConstIterator it(list.begin()); it != end; ++it) { m_pActivityLW->addItem(*it); } //now setup the signals connect(m_pActivityLW, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(slotClicked(QListWidgetItem*))); connect(m_pActivityLW, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotRightButtonPressed(QPoint))); connect(m_pTopArrowB, SIGNAL(clicked()), this, SLOT(slotTopClicked())); connect(m_pUpArrowB, SIGNAL(clicked()), this, SLOT(slotUpClicked())); connect(m_pDownArrowB, SIGNAL(clicked()), this, SLOT(slotDownClicked())); connect(m_pBottomArrowB, SIGNAL(clicked()), this, SLOT(slotBottomClicked())); connect(m_pActivityLW, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(slotDoubleClicked(QListWidgetItem*))); enableWidgets(false); }
void RightListToolbar::setUpUi() { mv_up_btn_ = new QPushButton(""); mv_up_btn_->setToolTip(tr("MoveUp")); mv_up_btn_->setObjectName("MoveUpBtn"); mv_up_btn_->setFlat(true); mv_up_btn_->setFixedSize(22, 22); mv_up_btn_->setIconSize(QSize(20, 20)); mv_dn_btn_ = new QPushButton(""); mv_dn_btn_->setToolTip(tr("MoveDown")); mv_dn_btn_->setObjectName("MoveDnBtn"); mv_dn_btn_->setFlat(true); mv_dn_btn_->setFixedSize(22, 22); mv_dn_btn_->setIconSize(QSize(20, 20)); mv_top_btn_ = new QPushButton(""); mv_top_btn_->setToolTip(tr("MoveTop")); mv_top_btn_->setObjectName("MoveTopBtn"); mv_top_btn_->setFlat(true); mv_top_btn_->setFixedSize(22, 22); mv_top_btn_->setIconSize(QSize(20, 20)); mv_btm_btn_ = new QPushButton(""); mv_btm_btn_->setToolTip(tr("MoveBottom")); mv_btm_btn_->setObjectName("MoveBtmBtn"); mv_btm_btn_->setFlat(true); mv_btm_btn_->setFixedSize(22, 22); mv_btm_btn_->setIconSize(QSize(20, 20)); dlt_btn_ = new QPushButton(""); dlt_btn_->setToolTip(tr("Delete")); dlt_btn_->setObjectName("DltBtn"); dlt_btn_->setFlat(true); dlt_btn_->setFixedSize(22, 22); dlt_btn_->setIconSize(QSize(20, 20)); QHBoxLayout *layout = new QHBoxLayout(this); layout->setSpacing(0); QSpacerItem *spacer_h0 = new QSpacerItem(10, 20, QSizePolicy::Expanding, QSizePolicy::Maximum); QSpacerItem *spacer_h1 = new QSpacerItem(10, 20, QSizePolicy::Expanding, QSizePolicy::Maximum); QSpacerItem *spacer_h2 = new QSpacerItem(10, 20, QSizePolicy::Expanding, QSizePolicy::Maximum); QSpacerItem *spacer_h3 = new QSpacerItem(10, 20, QSizePolicy::Expanding, QSizePolicy::Maximum); QSpacerItem *spacer_h4 = new QSpacerItem(10, 20, QSizePolicy::Expanding, QSizePolicy::Maximum); QSpacerItem *spacer_h5 = new QSpacerItem(10, 20, QSizePolicy::Expanding, QSizePolicy::Maximum); layout->addItem(spacer_h0); layout->addWidget(mv_up_btn_); layout->addItem(spacer_h1); layout->addWidget(mv_dn_btn_); layout->addItem(spacer_h2); layout->addWidget(mv_top_btn_); layout->addItem(spacer_h3); layout->addWidget(mv_btm_btn_); layout->addItem(spacer_h4); layout->addWidget(dlt_btn_); layout->addItem(spacer_h5); }