当前位置: 首页>>代码示例>>C++>>正文


C++ QLabel::setToolTip方法代码示例

本文整理汇总了C++中QLabel::setToolTip方法的典型用法代码示例。如果您正苦于以下问题:C++ QLabel::setToolTip方法的具体用法?C++ QLabel::setToolTip怎么用?C++ QLabel::setToolTip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QLabel的用法示例。


在下文中一共展示了QLabel::setToolTip方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QStatusBar

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& ) ) );
}
开发者ID:pasnox,项目名称:monkeystudio2,代码行数:34,代码来源:StatusBar.cpp

示例2: XDataField

    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());
        }
    }
开发者ID:sapo,项目名称:sapo-messenger-for-mac,代码行数:35,代码来源:xdata_widget.cpp

示例3: createCategoryInfoItem

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));
    }
}
开发者ID:jinting6949,项目名称:TTKMusicplayer,代码行数:32,代码来源:musicwebdjradioinfowidget.cpp

示例4: pic

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);
}
开发者ID:xtingray,项目名称:tupi,代码行数:31,代码来源:configurator.cpp

示例5: KColorButton

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;
}
开发者ID:KDE,项目名称:rocs,代码行数:28,代码来源:nodetypesdelegate.cpp

示例6: show_about

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;
}
开发者ID:pi-null-mezon,项目名称:QVideoProcessing,代码行数:34,代码来源:mainwindow.cpp

示例7: saveRecoveringFile

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 );
}
开发者ID:Dinesh-Ramakrishnan,项目名称:freemedforms,代码行数:27,代码来源:mfRecovererThread.cpp

示例8: QLabel

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();
}
开发者ID:kammoh,项目名称:kactus2,代码行数:35,代码来源:filegeneraleditor.cpp

示例9: setGUI

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++;
    }
}
开发者ID:YaShock,项目名称:Formulator,代码行数:25,代码来源:dialogformula.cpp

示例10: flags

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);
}
开发者ID:NoSuchProcess,项目名称:Compressonator,代码行数:60,代码来源:cpNewProject.cpp

示例11: showValidators

/** 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

}
开发者ID:trnielsen,项目名称:mantid,代码行数:27,代码来源:AlgorithmDialog.cpp

示例12: QWidget

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;
}
开发者ID:devernay,项目名称:ramen-1,代码行数:34,代码来源:popup_param.cpp

示例13: setPinModePWMOutput

// _____________________________________________________________________
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)));
    }
}
开发者ID:CRLG,项目名称:LABOTBOX,代码行数:27,代码来源:CRaspiGPIO.cpp

示例14: setPinModeOutput

// _____________________________________________________________________
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)));
    }
}
开发者ID:CRLG,项目名称:LABOTBOX,代码行数:33,代码来源:CRaspiGPIO.cpp

示例15: initItem

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
}
开发者ID:KDE,项目名称:kooka,代码行数:26,代码来源:statusbarmanager.cpp


注:本文中的QLabel::setToolTip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。