StatusBar::StatusBar( QWidget* parent ) : QStatusBar( parent ) { // create labels QLabel* label; label = ( mLabels[ltCursorPosition] = new QLabel( this ) ); label->setToolTip( tr( "Cursor position" ) ); label = ( mLabels[ltSaveState] = new QLabel( this ) ); label->setToolTip( tr( "Modification state of file" ) ); label = ( mLabels[ltEOLMode] = new QLabel( this ) ); label->setToolTip( tr( "EOL mode" ) ); label = ( mLabels[ltIndentMode] = new QLabel( this ) ); label->setToolTip( tr( "Indentation mode" ) ); // add labels for ( int i = ltCursorPosition; i < ltIndentMode +1; i++ ) { label = mLabels[ i ]; addPermanentWidget( label ); label->setMargin( 2 ); label->setFrameStyle( QFrame::NoFrame ); label->setAttribute( Qt::WA_MacSmallSize ); } // force remove statusbar label frame setStyleSheet( "QStatusBar::item { border: 0px; }" ); // connections connect( this, SIGNAL( messageChanged( const QString& ) ), this, SLOT( setMessage( const QString& ) ) ); }
XDataField_ListMulti(XData::Field f, QGridLayout *grid, int row, QWidget *parent) : XDataField(f) { QLabel *label = new QLabel(labelText(), parent); grid->addWidget(label, row, 0); list = new QListWidget(parent); grid->addWidget(list, row, 1); list->setSelectionMode(QAbstractItemView::MultiSelection); XData::Field::OptionList opts = f.options(); XData::Field::OptionList::Iterator it = opts.begin(); for ( ; it != opts.end(); ++it) { QString lbl = (*it).label; if ( lbl.isEmpty() ) lbl = (*it).value; QListWidgetItem* item = new QListWidgetItem(lbl,list); QStringList val = f.value(); QStringList::Iterator sit = val.begin(); for ( ; sit != val.end(); ++sit) if ( (*it).label == *sit || (*it).value == *sit ) list->setItemSelected(item, true); } QLabel *req = new QLabel(reqText(), parent); grid->addWidget(req, row, 2); if ( !f.desc().isEmpty() ) { label->setToolTip(f.desc()); list->setToolTip(f.desc()); req->setToolTip(f.desc()); } }
XDataField_Boolean(XData::Field f, QGridLayout *grid, int row, QWidget *parent) : XDataField(f) { bool checked = false; if ( f.value().count() ) { QString s = f.value().first(); if ( s == "1" || s == "true" || s == "yes" ) checked = true; } QLabel *label = new QLabel(labelText(), parent); grid->addWidget(label, row, 0); check = new QCheckBox(parent); check->setChecked(checked); grid->addWidget(check, row, 1); QLabel *req = new QLabel(reqText(), parent); grid->addWidget(req, row, 2); if ( !f.desc().isEmpty() ) { label->setToolTip(f.desc()); check->setToolTip(f.desc()); req->setToolTip(f.desc()); } }
XDataField_ListSingle(XData::Field f, QGridLayout *grid, int row, QWidget *parent) : XDataField(f) { QLabel *label = new QLabel(labelText(), parent); grid->addWidget(label, row, 0); combo = new QComboBox(parent); grid->addWidget(combo, row, 1); combo->setInsertionPolicy(QComboBox::NoInsertion); QString sel; if ( !f.value().isEmpty() ) sel = f.value().first(); XData::Field::OptionList opts = f.options(); XData::Field::OptionList::Iterator it = opts.begin(); for ( ; it != opts.end(); ++it) { QString lbl = (*it).label; if ( lbl.isEmpty() ) lbl = (*it).value; combo->insertItem(lbl); if ( (*it).value == sel ) combo->setCurrentText( lbl ); } QLabel *req = new QLabel(reqText(), parent); grid->addWidget(req, row, 2); if ( !f.desc().isEmpty() ) { label->setToolTip(f.desc()); combo->setToolTip(f.desc()); req->setToolTip(f.desc()); } }
void MusicWebDJRadioInfoWidget::createCategoryInfoItem(const MusicResultsItem &item) { m_currentPlaylistItem = item; createLabels(); if(!m_resizeWidgets.isEmpty()) { MusicDownloadSourceThread *download = new MusicDownloadSourceThread(this); connect(download, SIGNAL(downLoadByteDataChanged(QByteArray)), SLOT(downLoadFinished(QByteArray))); if(!item.m_coverUrl.isEmpty() && item.m_coverUrl != "null") { download->startToDownload(item.m_coverUrl); } QLabel *label = m_resizeWidgets[0]; label->setToolTip(item.m_name); label->setText(MusicUtils::Widget::elidedText(label->font(), label->toolTip(), Qt::ElideRight, 390)); label = m_resizeWidgets[1]; label->setToolTip(tr("Singer: %1").arg(item.m_nickName)); label->setText(MusicUtils::Widget::elidedText(label->font(), label->toolTip(), Qt::ElideRight, 390)); label = m_resizeWidgets[2]; label->setToolTip(tr("PlayCount: %1").arg(item.m_playCount)); label->setText(MusicUtils::Widget::elidedText(label->font(), label->toolTip(), Qt::ElideRight, 390)); label = m_resizeWidgets[3]; label->setToolTip(tr("UpdateTime: %1").arg(item.m_updateTime)); label->setText(MusicUtils::Widget::elidedText(label->font(), label->toolTip(), Qt::ElideRight, 390)); } }
XDataField_TextMulti(XData::Field f, QGridLayout *grid, int row, QWidget *parent) : XDataField(f) { QLabel *label = new QLabel(labelText(), parent); grid->addWidget(label, row, 0); edit = new QTextEdit(parent); grid->addWidget(edit, row, 1); QString text; QStringList val = f.value(); QStringList::Iterator it = val.begin(); for ( ; it != val.end(); ++it) { if ( !text.isEmpty() ) text += "\n"; text += *it; } edit->setText(text); QLabel *req = new QLabel(reqText(), parent); grid->addWidget(req, row, 2); if ( !f.desc().isEmpty() ) { label->setToolTip(f.desc()); edit->setToolTip(f.desc()); req->setToolTip(f.desc()); } }
Configurator::Configurator(QWidget *parent) : QFrame(parent), k(new Private) { k->framesCount = 1; k->currentFrame = 0; k->mode = TupToolPlugin::View; k->state = Manager; k->layout = new QBoxLayout(QBoxLayout::TopToBottom, this); k->layout->setAlignment(Qt::AlignHCenter | Qt::AlignTop); QLabel *toolTitle = new QLabel; toolTitle->setAlignment(Qt::AlignHCenter); QPixmap pic(THEME_DIR + "icons/opacity_tween.png"); toolTitle->setPixmap(pic.scaledToWidth(20, Qt::SmoothTransformation)); toolTitle->setToolTip(tr("Opacity Tween Properties")); k->layout->addWidget(toolTitle); k->layout->addWidget(new TSeparator(Qt::Horizontal)); k->settingsLayout = new QBoxLayout(QBoxLayout::TopToBottom); k->settingsLayout->setAlignment(Qt::AlignHCenter | Qt::AlignTop); k->settingsLayout->setMargin(0); k->settingsLayout->setSpacing(0); setTweenManagerPanel(); setButtonsPanel(); setPropertiesPanel(); k->layout->addLayout(k->settingsLayout); k->layout->addStretch(2); }
QList< QWidget* > NodeTypesDelegate::createItemWidgets(const QModelIndex &index) const { // items created by this method and added to the return-list will be // deleted by KWidgetItemDelegate KColorButton *colorButton = new KColorButton(index.data(NodeTypeModel::ColorRole).value<QColor>()); colorButton->setFlat(true); QLineEdit *title = new QLineEdit(index.data(NodeTypeModel::TitleRole).toString()); title->setMinimumWidth(100); QLabel *idLabel = new QLabel(index.data(NodeTypeModel::IdRole).toString()); idLabel->setToolTip(i18n("Unique ID of the node type.")); QToolButton *propertiesButton = new QToolButton(); propertiesButton->setIcon(QIcon::fromTheme("document-properties")); connect(colorButton, &KColorButton::changed, this, &NodeTypesDelegate::onColorChanged); connect(colorButton, &KColorButton::pressed, this, &NodeTypesDelegate::onColorDialogOpened); connect(title, &QLineEdit::textEdited, this, &NodeTypesDelegate::onNameChanged); connect(propertiesButton, &QToolButton::clicked, this, &NodeTypesDelegate::showPropertiesDialog); return QList<QWidget*>() << colorButton << title << idLabel << propertiesButton; }
void MainWindow::show_about() { QDialog *aboutdialog = new QDialog(); int pSize = aboutdialog->font().pointSize(); aboutdialog->setWindowTitle("About"); aboutdialog->setFixedSize(pSize*30,pSize*17); QVBoxLayout *templayout = new QVBoxLayout(); templayout->setMargin(APP_MARGIN); QLabel *projectname = new QLabel(QString(APP_NAME) +"\t"+ QString(APP_VERS)); projectname->setFrameStyle(QFrame::Box | QFrame::Raised); projectname->setAlignment(Qt::AlignCenter); QLabel *projectauthors = new QLabel("Designed by: Taranov Alex\n\nFirst release was in 2014"); projectauthors->setWordWrap(true); projectauthors->setAlignment(Qt::AlignCenter); QLabel *hyperlink = new QLabel("<a href='mailto:[email protected]?subject=QVideoProcessing'>Contact us at [email protected]"); hyperlink->setToolTip("Will try to open your default mail client"); hyperlink->setOpenExternalLinks(true); hyperlink->setAlignment(Qt::AlignCenter); templayout->addWidget(projectname); templayout->addWidget(projectauthors); templayout->addWidget(hyperlink); aboutdialog->setLayout(templayout); aboutdialog->exec(); delete hyperlink; delete projectauthors; delete projectname; delete templayout; delete aboutdialog; }
Q_TK_USING_CONSTANTS void mfRecovererThread::saveRecoveringFile( mfObject * mfo ) { if ( !mfo ) return; // Only one recovery at time if ( isRunning() ) return; stopped = false; m_Object = mfo; // put an icon into statusbar if ( !iconSetted ) { iconSetted = true; QLabel * lbl = new QLabel ( mfCore::mainWindow() ); lbl->setObjectName( "crashicon" ); lbl->setPixmap( tkTheme::icon(ICONCRASHRECOVER).pixmap(16,16) ); lbl->setToolTip( QCoreApplication::translate( "mfRecovererThread", "Crash recovering is in action.\n" "Recover your datas after a system or software crash." ) ); mfCore::mainWindow()->statusBar()->addPermanentWidget( lbl, 0 ); } // Let's go with low priority start( LowPriority ); }
FileGeneralEditor::FileGeneralEditor(QWidget *parent, QSharedPointer<File> file): QGroupBox(tr("General options"), parent), file_(file), logicalName_(this), logicalDefault_(tr("Generators can override logical name"), this), includeFile_(tr("File is include file"), this), externalDec_(tr("File contains external declarations"), this) { Q_ASSERT_X(file_, "FileGeneralEditor constructor", "Null File-pointer given for constructor"); QLabel* logicNameLabel = new QLabel(tr("Logical name (default):"), this); logicNameLabel->setToolTip(tr("Logical name for the file or directory.\n" "For example VHDL library name for a vhdl-file")); QVBoxLayout* topLayout = new QVBoxLayout(this); QHBoxLayout* nameLayout = new QHBoxLayout(); nameLayout->addWidget(logicNameLabel); nameLayout->addWidget(&logicalName_); topLayout->addLayout(nameLayout); topLayout->addWidget(&logicalDefault_); topLayout->addWidget(&includeFile_); topLayout->addWidget(&externalDec_); connect(&logicalName_, SIGNAL(textEdited(const QString&)), this, SLOT(onLogicalNameChanged()), Qt::UniqueConnection); connect(&logicalDefault_, SIGNAL(clicked(bool)), this, SLOT(onLogicalNameChanged()), Qt::UniqueConnection); connect(&includeFile_, SIGNAL(clicked(bool)), this, SLOT(onIncludeFileChanged()), Qt::UniqueConnection); connect(&externalDec_, SIGNAL(clicked(bool)), this, SLOT(onExternalDecChanged()), Qt::UniqueConnection); refresh(); }
void DialogFormula::setGUI(int actIndex) { // Create all input GUI widgets // Add them to the grid layout // The number of widget pairs corresponds with number of inputs in formula // Copy the label of input widgets from formula inputs int i = 0; for(auto& iter : (vctFormula->at(actIndex)).inputList()) { QLineEdit* line = new QLineEdit(ui->groupBox); QLabel* label = new QLabel(QString(iter.name + ":"), ui->groupBox); label->setToolTip(iter.tooltip); ui->gridLayout->addWidget(label, i, 0); ui->gridLayout->addWidget(line, i, 1); // Create and set validator for the line edit QRegExpValidator* vldtr = new QRegExpValidator(iter.regex, line); line->setValidator(vldtr); // Add line pointer to the input line vector vctInputLine.push_back(line); i++; } }
cpNewProject::cpNewProject(QWidget *parent): m_parent(parent) { setWindowTitle("New Project"); Qt::WindowFlags flags(Qt::Dialog | Qt::WindowCloseButtonHint | Qt::WindowTitleHint); setWindowFlags(flags); // //-------------------------------- // // Destination Name // //-------------------------------- QLabel *LName = new QLabel(tr("Name ")); LName->setToolTip("Enter a name for the new project"); m_LEName = new QLineEdit; m_LEName->setEchoMode(QLineEdit::Normal); m_HlayoutName = new QHBoxLayout; m_HlayoutName->addWidget(LName); m_HlayoutName->addWidget(m_LEName); // =================================================P // Destination File // ================================================= QLabel *m_lFolder = new QLabel; m_lFolder->setText("Location"); m_lFolder->setToolTip("Set the project location"); m_DestinationFolder = new QLineEdit; m_PBDestFileFolder = new QPushButton("...",this); m_PBDestFileFolder->setAutoDefault(true); m_PBDestFileFolder->setToolTip("Open file browser"); m_PBDestFileFolder->setMaximumWidth(30); QObject::connect(m_PBDestFileFolder, SIGNAL(clicked()), this, SLOT(onDestFileFolder())); m_HlayoutDestination = new QHBoxLayout; m_HlayoutDestination->addWidget(m_lFolder); m_HlayoutDestination->addWidget(m_DestinationFolder); m_HlayoutDestination->addWidget(m_PBDestFileFolder); //================ // Buttons //================ m_PBOk = new QPushButton("Ok"); m_PBCancel = new QPushButton("Cancel"); m_PBOk->setAutoDefault(true); m_PBCancel->setAutoDefault(true); QObject::connect(m_PBOk, SIGNAL(clicked()), this, SLOT(onPBOk())); QObject::connect(m_PBCancel, SIGNAL(clicked()), this, SLOT(onPBCancel())); m_HlayoutButtons = new QHBoxLayout; m_HlayoutButtons->addStretch(); m_HlayoutButtons->addWidget(m_PBOk); m_HlayoutButtons->addWidget(m_PBCancel); m_VlayoutWindow = new QVBoxLayout; m_VlayoutWindow->addLayout(m_HlayoutName); m_VlayoutWindow->addLayout(m_HlayoutDestination); m_VlayoutWindow->addLayout(m_HlayoutButtons); setLayout(m_VlayoutWindow); resize(400, 80); }
/** Show the validators for all the properties */ void AlgorithmDialog::showValidators() { // Do nothing for non-generic algorithm dialogs QStringList::const_iterator pend = m_algProperties.end(); for( QStringList::const_iterator pitr = m_algProperties.begin(); pitr != pend; ++pitr ) { const QString propName = *pitr; // Find the widget for this property. if (m_tied_properties.contains(propName)) { // Show/hide the validator label (that red star) QString error = ""; if (m_errors.contains(propName)) error = m_errors[propName]; QLabel *validator = getValidatorMarker(propName); // If there's no validator then assume it's handling its own validation notification if( validator && validator->parent() ) { validator->setToolTip( error ); validator->setVisible( error.length() != 0); } } // widget is tied } // for each property }
QWidget *popup_param_t::do_create_widgets() { QWidget *top = new QWidget(); QLabel *label = new QLabel( top); menu_ = new QComboBox( top); menu_->setFocusPolicy( Qt::NoFocus); for( int i = 0; i < menu_items_.size(); ++i) { if( menu_items_[i] == "--") menu_->insertSeparator( menu_->count()); else menu_->addItem( menu_items_[i].c_str()); } QSize s = menu_->sizeHint(); label->move( 0, 0); label->resize( app().ui()->inspector().left_margin() - 5, s.height()); label->setAlignment( Qt::AlignRight | Qt::AlignVCenter); label->setText( name().c_str()); label->setToolTip( id().c_str()); menu_->move( app().ui()->inspector().left_margin(), 0); menu_->resize( s.width(), s.height()); menu_->setCurrentIndex( get_value<int>( *this)); menu_->setEnabled( enabled()); connect( menu_, SIGNAL( currentIndexChanged( int)), this, SLOT( item_picked( int))); top->setMinimumSize( app().ui()->inspector().width(), s.height()); top->setMaximumSize( app().ui()->inspector().width(), s.height()); top->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed); return top; }
// _____________________________________________________________________ void CRaspiGPIO::setPinModePWMOutput(unsigned int gpio_num, unsigned int init_pwm) { pinMode(gpio_num, PWM_OUTPUT); QString txt = "P"; QString tooltip = "PWM Output"; QLabel *lbl = m_ihm.findChild<QLabel*>(PREFIX_MODE_GPIO + QString::number(gpio_num)); if (lbl) { lbl->setText(txt); lbl->setToolTip(tooltip); } QLabel *lbl_name = m_ihm.findChild<QLabel*>(PREFIX_GPIO_NAME + QString::number(gpio_num)); if (lbl_name) { lbl_name->setEnabled(true); } m_raspi_pins_config[gpio_num] = tRaspiPinConfig { PWM_OUTPUT, PUD_OFF, init_pwm}; // Crée la data dans le data manager et l'associe à une callback pour déclencher l'écriture sur le port sur changement de valeur de la data writePwmPin(gpio_num, init_pwm); QString dataname = PREFIX_RASPI_OUT_DATANAME + QString::number(gpio_num); m_application->m_data_center->write(dataname, init_pwm); CData *data = m_application->m_data_center->getData(dataname); if (data) { connect (data, SIGNAL(valueChanged(double)), this, SLOT(onDataChangeWritePWM(double))); } }
// _____________________________________________________________________ void CRaspiGPIO::setPinModeOutput(unsigned int gpio_num, unsigned int init_state) { pinMode(gpio_num, OUTPUT); digitalWrite(gpio_num, init_state); QString txt = "O"; QString tooltip = "Digital Output"; QLabel *lbl = m_ihm.findChild<QLabel*>(PREFIX_MODE_GPIO + QString::number(gpio_num)); if (lbl) { lbl->setText(txt); lbl->setToolTip(tooltip); lbl->setEnabled(true); } QLabel *lbl_name = m_ihm.findChild<QLabel*>(PREFIX_GPIO_NAME + QString::number(gpio_num)); if (lbl_name) { lbl_name->setEnabled(true); } QCheckBox *checkbox = m_ihm.findChild<QCheckBox*>(PREFIX_CHECKBOX_WRITE + QString::number(gpio_num)); if (checkbox) { checkbox->setEnabled(true); } m_raspi_pins_config[gpio_num] = tRaspiPinConfig { OUTPUT, PUD_OFF, init_state}; // Crée la data dans le data manager et l'associe à une callback pour déclencher l'écriture sur le port sur changement de valeur de la data QString dataname = PREFIX_RASPI_OUT_DATANAME + QString::number(gpio_num); m_application->m_data_center->write(dataname, init_state); CData *data = m_application->m_data_center->getData(dataname); if (data) { connect (data, SIGNAL(valueUpdated(QVariant)), this, SLOT(onDataChangeWrite(QVariant))); } }
void StatusBarManager::initItem(const QString &text, StatusBarManager::Item item, const QString &tooltip) { mStatusBar->insertPermanentItem(QString::null, item); // There is no official access within KStatusBar to the widgets created // for each item. So to set a tool tip we have to search for them as // children of the status bar. // // The item just added will be the last QLabel child of the status bar. // It is always a QLabel, see KStatusBar::insertPermanentItem(). // It is always the last, see QObject::children(). if (!tooltip.isEmpty()) { const QList<QLabel *> childs = mStatusBar->findChildren<QLabel *>(); Q_ASSERT(!childs.isEmpty()); QLabel *addedItem = childs.last(); addedItem->setToolTip(tooltip); } setStatus((text+"--"), item); // allow some extra space mStatusBar->setItemFixed(item); // fix at current size mStatusBar->changeItem(QString::null, item); // clear initial contents }
QgsScaleRangeWidget::QgsScaleRangeWidget( QWidget *parent ) : QWidget( parent ) , mCanvas( nullptr ) { mLayout = new QGridLayout( this ); mLayout->setContentsMargins( 0, 0, 0, 0 ); QLabel* minLbl = new QLabel( tr( "Minimum\n(exclusive)" ), this ); minLbl->setWordWrap( true ); minLbl->setAlignment( Qt::AlignTop ); minLbl->setToolTip( tr( "Minimum scale, i.e. maximum scale denominator. " "This limit is exclusive, that means the layer will not be displayed on this scale." ) ); QLabel* maxLbl = new QLabel( tr( "Maximum\n(inclusive)" ), this ); maxLbl->setWordWrap( true ); maxLbl->setAlignment( Qt::AlignTop ); maxLbl->setToolTip( tr( "Maximum scale, i.e. minimum scale denominator. " "This limit is inclusive, that means the layer will be displayed on this scale." ) ); mMinimumScaleIconLabel = new QLabel( this ); mMinimumScaleIconLabel->setPixmap( QgsApplication::getThemePixmap( "/mActionZoomOut.svg" ) ); mMaximumScaleIconLabel = new QLabel( this ); mMaximumScaleIconLabel->setPixmap( QgsApplication::getThemePixmap( "/mActionZoomIn.svg" ) ); mMinimumScaleWidget = new QgsScaleWidget( this ); mMaximumScaleWidget = new QgsScaleWidget( this ); connect( mMinimumScaleWidget, SIGNAL( scaleChanged( double ) ), mMaximumScaleWidget, SLOT( setMinScale( double ) ) ); mMinimumScaleWidget->setShowCurrentScaleButton( true ); mMaximumScaleWidget->setShowCurrentScaleButton( true ); reloadProjectScales(); // add start, add comprehension of scales by settings fake ordered values mMinimumScaleWidget->setScale( 1.0 / 100000 ); mMaximumScaleWidget->setScale( 1.0 / 1000 ); mLayout->addWidget( minLbl, 0, 0, 2, 1 ); mLayout->addWidget( mMinimumScaleIconLabel, 0, 1 ); mLayout->addWidget( mMinimumScaleWidget, 0, 2 ); mLayout->addWidget( maxLbl, 0, 3, 2, 1 ); mLayout->addWidget( mMaximumScaleIconLabel, 0, 4 ); mLayout->addWidget( mMaximumScaleWidget, 0, 5 ); mLayout->setColumnStretch( 0, 0 ); mLayout->setColumnStretch( 1, 0 ); mLayout->setColumnStretch( 2, 3 ); mLayout->setColumnStretch( 3, 0 ); mLayout->setColumnStretch( 4, 0 ); mLayout->setColumnStretch( 5, 3 ); }
QLabel *CertDetail::labelFromAsn1String(ASN1_STRING *s) { QLabel *label; label = new CopyLabel(this); label->setText(asn1ToQString(s)); label->setToolTip(QString(ASN1_tag2str(s->type))); return label; }
QWidget *QgsProcessingDistanceWidgetWrapper::createWidget() { const QgsProcessingParameterDistance *distanceDef = static_cast< const QgsProcessingParameterDistance * >( parameterDefinition() ); QWidget *spin = QgsProcessingNumericWidgetWrapper::createWidget(); switch ( type() ) { case QgsProcessingGui::Standard: { mLabel = new QLabel(); mUnitsCombo = new QComboBox(); mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::DistanceMeters ), QgsUnitTypes::DistanceMeters ); mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::DistanceKilometers ), QgsUnitTypes::DistanceKilometers ); mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::DistanceFeet ), QgsUnitTypes::DistanceFeet ); mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::DistanceMiles ), QgsUnitTypes::DistanceMiles ); mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::DistanceYards ), QgsUnitTypes::DistanceYards ); const int labelMargin = static_cast< int >( std::round( mUnitsCombo->fontMetrics().width( 'X' ) ) ); QHBoxLayout *layout = new QHBoxLayout(); layout->addWidget( spin, 1 ); layout->insertSpacing( 1, labelMargin / 2 ); layout->insertWidget( 2, mLabel ); layout->insertWidget( 3, mUnitsCombo ); // bit of fiddlyness here -- we want the initial spacing to only be visible // when the warning label is shown, so it's embedded inside mWarningLabel // instead of outside it mWarningLabel = new QWidget(); QHBoxLayout *warningLayout = new QHBoxLayout(); warningLayout->setMargin( 0 ); warningLayout->setContentsMargins( 0, 0, 0, 0 ); QLabel *warning = new QLabel(); QIcon icon = QgsApplication::getThemeIcon( QStringLiteral( "mIconWarning.svg" ) ); const int size = static_cast< int >( std::max( 24.0, spin->minimumSize().height() * 0.5 ) ); warning->setPixmap( icon.pixmap( icon.actualSize( QSize( size, size ) ) ) ); warning->setToolTip( tr( "Distance is in geographic degrees. Consider reprojecting to a projected local coordinate system for accurate results." ) ); warningLayout->insertSpacing( 0, labelMargin / 2 ); warningLayout->insertWidget( 1, warning ); mWarningLabel->setLayout( warningLayout ); layout->insertWidget( 4, mWarningLabel ); setUnits( distanceDef->defaultUnit() ); QWidget *w = new QWidget(); layout->setMargin( 0 ); layout->setContentsMargins( 0, 0, 0, 0 ); w->setLayout( layout ); return w; } case QgsProcessingGui::Batch: case QgsProcessingGui::Modeler: return spin; } return nullptr; }
/* Creates a property item 'val' in a parameter category specified by its 'box'. */ void QucsTranscalc::createPropItem (QGridLayout * parentGrid, TransValue * val, int box, QButtonGroup * group) { Q_UNUSED(group); QRadioButton * r = NULL; QLabel * l; QLineEdit * e; QComboBox * c; QDoubleValidator * v = new QDoubleValidator (this); // name label l = new QLabel (val->name); parentGrid->addWidget(l, parentGrid->rowCount(), 0); l->setAlignment (Qt::AlignRight); if (val->tip) l->setToolTip(*(val->tip)); val->label = l; // editable value text e = new QLineEdit (); parentGrid->addWidget(e, parentGrid->rowCount()-1, 1); e->setText (QString::number (val->value)); e->setAlignment (Qt::AlignRight); e->setValidator (v); connect(e, SIGNAL(textChanged(const QString&)), SLOT(slotValueChanged())); if (!val->name) e->setDisabled (true); val->lineedit = e; // unit choice c = new QComboBox (); parentGrid->addWidget(c, parentGrid->rowCount()-1, 2); if (!val->units[0]) { c->addItem ("NA"); c->setDisabled(true); } else { int nounit = 0; for (int i = 0; val->units[i]; i++) { c->addItem (val->units[i]); if (!strcmp (val->units[i], "NA")) nounit++; } c->setDisabled (nounit != 0); c->setCurrentIndex (0); } connect(c, SIGNAL(activated(int)), SLOT(slotValueChanged())); val->combobox = c; // special synthesize-computation choice if (box == TRANS_PHYSICAL) { r = new QRadioButton (); r->setDisabled (true); r->setHidden(true); val->radio = r; parentGrid->addWidget(r, parentGrid->rowCount()-1, 3); } }
void UpcomingEventsWidget::setLocation( const LastFmLocationPtr &loc ) { QString text = QString( "%1, %2" ).arg( loc->city ).arg( loc->country ); if( !loc->street.isEmpty() ) text.prepend( loc->street + ", " ); QLabel *locLabel = static_cast<QLabel*>( m_location->widget() ); locLabel->setText( text ); locLabel->setToolTip( i18nc( "@info:tooltip", "<strong>Location:</strong><nl/>%1", text ) ); }
QWidget * ExtcapArgument::createLabel(QWidget * parent) { if ( _argument == 0 || _argument->display == 0 ) return 0; QString text = QString().fromUtf8(_argument->display); QLabel * label = new QLabel(text, parent); if ( _argument->tooltip != 0 ) label->setToolTip(QString().fromUtf8(_argument->tooltip)); return label; }
void UpcomingEventsWidget::setDate( const KDateTime &date ) { QLabel *dateLabel = static_cast<QLabel*>( m_date->widget() ); dateLabel->setText( KGlobal::locale()->formatDateTime( date, KLocale::FancyLongDate ) ); KDateTime currentDT = KDateTime::currentLocalDateTime(); if( currentDT.compare(date) == KDateTime::Before ) { int daysTo = currentDT.daysTo( date ); dateLabel->setToolTip( i18ncp( "@info:tooltip Number of days till an event", "Tomorrow", "In <strong>%1</strong> days", daysTo ) ); } }
foreach (const Login::UserInfo &user, userInfos) { if (!userIsBot(user)) { QLabel *label = new QLabel(ui->usersPanel); label->setTextFormat(Qt::RichText); Geo::Location userLocation = mainController->getGeoLocation(user.getIp()); QString userString = user.getName(); QString imageString = ""; if (!userLocation.isUnknown()) { userString += " <i>(" + userLocation.getCountryName() + ")</i>"; QString countryCode = userLocation.getCountryCode().toLower(); imageString = "<img src=:/flags/flags/" + countryCode +".png> "; label->setToolTip(""); } else { imageString = "<img src=:/images/warning.png> "; label->setToolTip(user.getName() + " location is not available at moment!"); } label->setText(imageString + userString); ui->usersPanel->layout()->addWidget(label); ui->usersPanel->layout()->setAlignment(Qt::AlignTop); } }
void DetailWindow::blankKeyLabel(){ deleteKeyLabels(); QLabel* dummyLabel = new QLabel(); QPalette pal = dummyLabel->palette(); pal.setColor(backgroundRole(), Qt::black); dummyLabel->setPalette(pal); dummyLabel->setAutoFillBackground(true); dummyLabel->setMinimumHeight(20); dummyLabel->setMaximumHeight(30); dummyLabel->setToolTip(wrapToolTip(tr("Drag an audio file onto the window."))); ui->horizontalLayout_keyLabels->addWidget(dummyLabel); keyLabels.push_back(dummyLabel); }
QLabel* AbstractStatisticsWidget::addStatisticLabel ( const QString& description, const QString& initialValue, const QString& toolTip ) { QHBoxLayout* layout = new QHBoxLayout(); layout->setContentsMargins(2, 2, 2, 2); QLabel* descriptionLabel = new QLabel(description); descriptionLabel->setAlignment(Qt::AlignRight); QLabel* valueLabel = new QLabel(QString("<b>%1</b>").arg(initialValue)); valueLabel->setTextFormat(Qt::RichText); valueLabel->setAlignment(Qt::AlignLeft); layout->addWidget(descriptionLabel); layout->addWidget(valueLabel); layout->setSizeConstraint(QLayout::SetMinimumSize); QWidget* containerWidget = new QWidget(); containerWidget->setLayout(layout); QListWidgetItem* item = new QListWidgetItem(); item->setSizeHint(containerWidget->sizeHint()); this->addItem(item); this->setItemWidget(item, containerWidget); if (!toolTip.isNull()) { descriptionLabel->setToolTip(toolTip); valueLabel->setToolTip(toolTip); } return valueLabel; }
KStatusBarOfflineIndicator::KStatusBarOfflineIndicator( QWidget * parent) : QWidget( parent), d( new KStatusBarOfflineIndicatorPrivate( this ) ) { QVBoxLayout * layout = new QVBoxLayout( this ); layout->setMargin( 2 ); QLabel * label = new QLabel( this ); label->setPixmap( SmallIcon("network-disconnect") ); label->setToolTip( i18n( "The desktop is offline" ) ); layout->addWidget( label ); d->initialize(); connect( Solid::Networking::notifier(), SIGNAL(statusChanged(Solid::Networking::Status)), SLOT(_k_networkStatusChanged(Solid::Networking::Status)) ); }
XDataField_TextSingle(XData::Field f, QGridLayout *grid, int row, QWidget *parent) : XDataField(f) { QString text; if ( f.value().count() ) text = f.value().first(); QLabel *label = new QLabel(labelText(), parent); grid->addWidget(label, row, 0); edit = new QLineEdit(parent); edit->setText(text); grid->addWidget(edit, row, 1); QLabel *req = new QLabel(reqText(), parent); grid->addWidget(req, row, 2); if ( !f.desc().isEmpty() ) { label->setToolTip(f.desc()); edit->setToolTip(f.desc()); req->setToolTip(f.desc()); } }