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


C++ QToolButton::setIconSet方法代码示例

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


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

示例1: setIcon

QucsEdit::QucsEdit(const QString& FileName_, bool readOnly)
{
  // set application icon
  setIcon (QPixmap(QucsSettings.BitmapDir + "big.qucs.xpm"));
  setCaption("Qucs Editor " PACKAGE_VERSION " - " + tr("File: "));

  QVBoxLayout *v = new QVBoxLayout(this);

  QHBox *h = new QHBox(this);
  v->addWidget(h);

  QToolButton *ButtLoad = new QToolButton(h);
  ButtLoad->setIconSet(
	    QIconSet(QImage(QucsSettings.BitmapDir + "fileopen.png")));
  connect(ButtLoad, SIGNAL(clicked()), SLOT(slotLoad()));

  QToolButton *ButtSave = new QToolButton(h);
  ButtSave->setIconSet(
            QIconSet(QImage(QucsSettings.BitmapDir + "filesave.png")));
  connect(ButtSave, SIGNAL(clicked()), SLOT(slotSave()));
  ButtSave->setDisabled(readOnly);

  h->setStretchFactor(new QWidget(h),5); // stretchable placeholder
  PosText = new QLabel(tr("Line: %1  -  Column: %2").arg(1).arg(1), h);
  h->setStretchFactor(new QWidget(h),5); // stretchable placeholder

  QPushButton *ButtAbout = new QPushButton(tr("About"),h);
  connect(ButtAbout, SIGNAL(clicked()), SLOT(slotAbout()));

  QPushButton *ButtOK = new QPushButton(tr("Quit"),h);
  connect(ButtOK, SIGNAL(clicked()), SLOT(slotQuit()));
  ButtOK->setFocus();

  // try using same-sized mono-spaced font in the textarea
  QFont fedit = QFont("Courier New");
  fedit.setPointSize(QucsSettings.font.pointSize()-1);
  fedit.setStyleHint(QFont::Courier);
  fedit.setFixedPitch(true);

  text = new QTextEdit(this);
  text->setTextFormat(Qt::PlainText);
  text->setReadOnly(readOnly);
  text->setWordWrap(QTextEdit::NoWrap);
  text->setMinimumSize(300,200);
  text->setFont(fedit);
  text->setCurrentFont(fedit);
  v->addWidget(text);
  connect(text, SIGNAL(cursorPositionChanged(int, int)),
          SLOT(slotPrintCursorPosition(int, int)));

  // .................................................
  loadFile(FileName_);
}
开发者ID:MikeBrinson,项目名称:qucs,代码行数:53,代码来源:qucsedit.cpp

示例2: KDialog

/// Pixmap Collection Editor Dialog
PixmapCollectionEditor::PixmapCollectionEditor(PixmapCollection *collection, QWidget *parent)
        : KDialog(parent, "pixcollection_dialog", true,
                  i18n("Edit Pixmap Collection: %1", collection->collectionName()), Close, Close, false)
{
    m_collection = collection;
    QFrame *frame = makeMainWidget();
    QHBoxLayout *l = new QHBoxLayout(frame);
    setInitialSize(QSize(400, 200), true);

    //// Setup the icon toolbar /////////////////
    QVBoxLayout *vlayout = new QVBoxLayout(l);
    QToolButton *newItemPath = new QToolButton(frame);
    newItemPath->setIconSet(koIcon("document-open"));
    newItemPath->setTextLabel(i18n("&Add File"), true);
    vlayout->addWidget(newItemPath);
    m_buttons.insert(BNewItemPath, newItemPath);
    connect(newItemPath, SIGNAL(clicked()), this, SLOT(newItemByPath()));

    QToolButton *newItemName = new QToolButton(frame);
    newItemName->setIconSet(koIcon("list-add"));
    newItemName->setTextLabel(i18n("&Add an Icon"), true);
    vlayout->addWidget(newItemName);
    m_buttons.insert(BNewItemName, newItemName);
    connect(newItemName, SIGNAL(clicked()), this, SLOT(newItemByName()));

    QToolButton *delItem = new QToolButton(frame);
    delItem->setIconSet(koIcon("list-remove"));
    delItem->setTextLabel(i18n("&Remove Selected Item"), true);
    vlayout->addWidget(delItem);
    m_buttons.insert(BDelItem, delItem);
    connect(delItem, SIGNAL(clicked()), this, SLOT(removeItem()));
    vlayout->addStretch();

    // Setup the iconView
    m_iconView = new K3IconView(frame, "pixcollection_iconView");
    m_iconView->resize(100, 100);
    m_iconView->setArrangement(Q3IconView::LeftToRight);
    m_iconView->setAutoArrange(true);
    m_iconView->setMode(K3IconView::Select);
    l->addWidget(m_iconView);
    connect(m_iconView, SIGNAL(contextMenuRequested(Q3IconViewItem*,QPoint)), this, SLOT(displayMenu(Q3IconViewItem*,QPoint)));
    connect(m_iconView, SIGNAL(itemRenamed(Q3IconViewItem*,QString)), this, SLOT(renameCollectionItem(Q3IconViewItem*,QString)));

    PixmapMap::ConstIterator it;
    PixmapMap::ConstIterator endIt = collection->m_pixmaps.end();
    for (it = collection->m_pixmaps.constBegin(); it != endIt; ++it)
        createIconViewItem(it.key());
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:49,代码来源:pixmapcollection.cpp

示例3: QLabel

CColorPopup::CColorPopup (QWidget * parent, const char *name, Qt::WFlags f)
:QWidget (parent, name, f)
{
    colorShower = new QLabel (this, "color shower");
    colorShower->setFrameStyle (Q3Frame::WinPanel | Q3Frame::Sunken);
    colorShower->setLineWidth (2);
    colorShower->setMidLineWidth (1);
    colorShower->resize (37, 20);
    colorShower->setPaletteBackgroundColor (QColor (0, 0, 0));
    colorShower->move (5, 2);
    colorName = new Q3TextEdit (this);
    colorName->resize (55, 20);
    colorName->move (50, 2);
    colorName->setHScrollBarMode (Q3ScrollView::AlwaysOff);
    colorName->setVScrollBarMode (Q3ScrollView::AlwaysOff);
    
	QFont f1 ("Times", 8, QFont::Light);
    colorName->setFont (f1);
    colorName->clearFocus ();
    s = new CColorSwatches (this, "", ((CTools *) parent)->dad);
    s->resize (210, 125);
    s->move (2, 29);
    
	QToolButton * colordialog =new CToolButton (this, tr ("Open color dialog"));
    colordialog->move (180, 3);
    colordialog->resize (20, 20);
    colordialog->setIconSet (QIcon (QPixmap ("colordialogBut.png")));
    colordialog->setTextLabel (trUtf8 ("Open Color Dialog"));
    connect (colordialog, SIGNAL (clicked ()), this,SLOT (slotColordialog ()));

        //setFocusPolicy (QWidget::StrongFocus);
    setMouseTracking (true);
    mcursor = QPixmap ((const char **) eye_dropper_tool_xpm);
    setCursor (QCursor (mcursor, 1, 15));
}
开发者ID:ozkanpakdil,项目名称:f4l,代码行数:35,代码来源:colorpopup.cpp

示例4: QButtonGroup

QWidget *Frame::createCategoryPage( CategoryInterface *c )
{
    QButtonGroup *g = new QButtonGroup( 1, Horizontal, toolBox );
    g->setFrameStyle( QFrame::NoFrame );
    g->setEraseColor(green);
    g->setBackgroundMode(PaletteBase);
    for ( int i = 0; i < c->numCategories(); ++i ) {
	QToolButton *b = new QToolButton( g );
	b->setBackgroundMode(PaletteBase);
	b->setTextLabel( c->categoryName( i ) );
	b->setIconSet( c->categoryIcon( i ) );
	b->setAutoRaise( TRUE );
	b->setTextPosition( QToolButton::Right );
	b->setUsesTextLabel( TRUE );
	g->insert( b, i + c->categoryOffset() );
	connect( g, SIGNAL( clicked( int ) ), c, SLOT( setCurrentCategory( int ) ) );
    }
    return g;
}
开发者ID:nightfly19,项目名称:renyang-learn,代码行数:19,代码来源:frame.cpp

示例5: QToolButton


//.........这里部分代码省略.........
    WindowsMenu = new QPopupMenu ( this );
    WindowsMenu->setCheckable ( true );
    connect ( WindowsMenu, SIGNAL ( aboutToShow() ), this, SLOT ( windowsMenu() ) );
    menuBar() ->insertItem ( "&Window", WindowsMenu, TO_WINDOWS_MENU );

    menuBar() ->insertSeparator();

    menuBar() ->insertItem ( "&Help", HelpMenu, TO_HELP_MENU );

    char buffer[100];
    sprintf ( buffer, DEFAULT_TITLE, TOVERSION );
    setCaption ( buffer );

#ifdef TO_KDE
    KDockWidget *mainDock = createDockWidget ( buffer, QPixmap ( ( const char ** ) toramini_xpm ) );
    Workspace = new QWorkspace ( mainDock );
    mainDock->setWidget ( Workspace );
    setView ( mainDock );
    setMainDockWidget ( mainDock );
    mainDock->setEnableDocking ( KDockWidget::DockNone );
#else
    Workspace = new QWorkspace ( this );
    setCentralWidget ( Workspace );
#endif
    setIcon ( QPixmap ( ( const char ** ) toramini_xpm ) );

    statusBar() ->message ( "Ready" );
    menuBar() ->setItemEnabled ( TO_CLOSE_CONNECTION, false );
    menuBar() ->setItemEnabled ( TO_FILE_COMMIT, false );
    menuBar() ->setItemEnabled ( TO_FILE_ROLLBACK, false );
    menuBar() ->setItemEnabled ( TO_FILE_CLEARCACHE, false );
    DisconnectButton->setEnabled ( false );

    for ( std::map<QToolButton *, toTool *>::iterator j = NeedConnection.begin();
            j != NeedConnection.end();j++ )
        ( *j ).first->setEnabled ( false );

    connect ( menuBar(), SIGNAL ( activated ( int ) ), this, SLOT ( commandCallback ( int ) ) );

    RowLabel = new QLabel ( statusBar() );
    statusBar() ->addWidget ( RowLabel, 0, true );
    RowLabel->setMinimumWidth ( 60 );
    RowLabel->hide();

    ColumnLabel = new QLabel ( statusBar() );
    statusBar() ->addWidget ( ColumnLabel, 0, true );
    ColumnLabel->setMinimumWidth ( 60 );
    ColumnLabel->hide();

    QToolButton *dispStatus = new toPopupButton ( statusBar() );
    dispStatus->setIconSet ( QPixmap ( ( const char ** ) up_xpm ) );
    statusBar() ->addWidget ( dispStatus, 0, true );
    StatusMenu = new QPopupMenu ( dispStatus );
    dispStatus->setPopup ( StatusMenu );
    connect ( StatusMenu, SIGNAL ( aboutToShow() ),
              this, SLOT ( statusMenu() ) );
    connect ( StatusMenu, SIGNAL ( activated ( int ) ), this, SLOT ( commandCallback ( int ) ) );

    toolID = TO_TOOLS;
    for ( std::map<QString, toTool *>::iterator k = tools.begin();k != tools.end();k++ ) {
        ( *k ).second->customSetup ( toolID );
        toolID++;
    }
    Search = NULL;

    if ( !toTool::globalConfig ( CONF_MAXIMIZE_MAIN, "Yes" ).isEmpty() )
        showMaximized();
    show();

    QString welcome;

    do {
        welcome = toCheckLicense ( false );
    } while ( welcome.isNull() );

    toStatusMessage ( welcome, true );

    connect ( &Poll, SIGNAL ( timeout() ), this, SLOT ( checkCaching() ) );

    try {
        toNewConnection newConnection ( this, "First connection", true );

        toConnection *conn;

        do {
            conn = NULL;
            if ( newConnection.exec() ) {
                conn = newConnection.makeConnection();
            } else {
                break;
            }
        } while ( !conn );

        if ( conn )
            addConnection ( conn );
    }
    TOCATCH
    connect ( toMainWidget() ->workspace(), SIGNAL ( windowActivated ( QWidget * ) ),
              this, SLOT ( windowActivated ( QWidget * ) ) );
}
开发者ID:JustDevZero,项目名称:bulmages,代码行数:101,代码来源:tomain.cpp

示例6: plainPage

popupPublic::popupPublic(QWidget *parent, const char *name,QString sfile,bool filemode,KShortcut goDefaultKey):
KDialogBase( Plain, i18n("Select Public Key"), Details | Ok | Cancel, Ok, parent, name,true)
{

	QWidget *page = plainPage();
	QVBoxLayout *vbox=new QVBoxLayout(page,0,spacingHint());
	vbox->setAutoAdd(true);

	setButtonText(KDialogBase::Details,i18n("Options"));

        if (KGpgSettings::allowCustomEncryptionOptions())
                customOptions=KGpgSettings::customEncryptionOptions();

        KIconLoader *loader = KGlobal::iconLoader();

        keyPair=loader->loadIcon("kgpg_key2",KIcon::Small,20);
        keySingle=loader->loadIcon("kgpg_key1",KIcon::Small,20);
	keyGroup=loader->loadIcon("kgpg_key3",KIcon::Small,20);

        if (filemode) setCaption(i18n("Select Public Key for %1").arg(sfile));
        fmode=filemode;

	QHButtonGroup *hBar=new QHButtonGroup(page);
	//hBar->setFrameStyle(QFrame::NoFrame);
	hBar->setMargin(0);

#if KDE_IS_VERSION( 3, 2, 90 )
	QToolButton *clearSearch = new QToolButton(hBar);
	clearSearch->setTextLabel(i18n("Clear Search"), true);
	clearSearch->setIconSet(SmallIconSet(QApplication::reverseLayout() ? "clear_left"
                                            : "locationbar_erase"));
	(void) new QLabel(i18n("Search: "),hBar);
	KListViewSearchLine* listViewSearch = new KListViewSearchLine(hBar);
	connect(clearSearch, SIGNAL(pressed()), listViewSearch, SLOT(clear()));
#endif

        keysList = new KListView( page );
	 keysList->addColumn(i18n("Name"));
	 keysList->addColumn(i18n("Email"));
	 keysList->addColumn(i18n("ID"));

#if KDE_IS_VERSION( 3, 2, 90 )
	 listViewSearch->setListView(keysList);
#endif

        keysList->setRootIsDecorated(false);
        page->setMinimumSize(540,200);
        keysList->setShowSortIndicator(true);
        keysList->setFullWidth(true);
	keysList->setAllColumnsShowFocus(true);
        keysList->setSelectionModeExt(KListView::Extended);
	keysList->setColumnWidthMode(0,QListView::Manual);
	keysList->setColumnWidthMode(1,QListView::Manual);
	keysList->setColumnWidth(0,210);
	keysList->setColumnWidth(1,210);

        boutonboxoptions=new QButtonGroup(5,Qt::Vertical ,page,0);

	KActionCollection *actcol=new KActionCollection(this);
	(void) new KAction(i18n("&Go to Default Key"),goDefaultKey, this, SLOT(slotGotoDefaultKey()),actcol,"go_default_key");


        CBarmor=new QCheckBox(i18n("ASCII armored encryption"),boutonboxoptions);
        CBuntrusted=new QCheckBox(i18n("Allow encryption with untrusted keys"),boutonboxoptions);
        CBhideid=new QCheckBox(i18n("Hide user id"),boutonboxoptions);
        setDetailsWidget(boutonboxoptions);
        QWhatsThis::add
                (keysList,i18n("<b>Public keys list</b>: select the key that will be used for encryption."));
        QWhatsThis::add
                (CBarmor,i18n("<b>ASCII encryption</b>: makes it possible to open the encrypted file/message in a text editor"));
        QWhatsThis::add
                (CBhideid,i18n("<b>Hide user ID</b>: Do not put the keyid into encrypted packets. This option hides the receiver "
                                "of the message and is a countermeasure against traffic analysis. It may slow down the decryption process because "
                                "all available secret keys are tried."));
        QWhatsThis::add
                (CBuntrusted,i18n("<b>Allow encryption with untrusted keys</b>: when you import a public key, it is usually "
                                  "marked as untrusted and you cannot use it unless you sign it in order to make it 'trusted'. Checking this "
                                  "box enables you to use any key, even if it has not be signed."));

        if (filemode) {
		QWidget *parentBox=new QWidget(boutonboxoptions);
		QHBoxLayout *shredBox=new QHBoxLayout(parentBox,0);
		//shredBox->setFrameStyle(QFrame::NoFrame);
		//shredBox->setMargin(0);
	       CBshred=new QCheckBox(i18n("Shred source file"),parentBox);
                QWhatsThis::add
                        (CBshred,i18n("<b>Shred source file</b>: permanently remove source file. No recovery will be possible"));

		QString shredWhatsThis = i18n( "<qt><b>Shred source file:</b><br /><p>Checking this option will shred (overwrite several times before erasing) the files you have encrypted. This way, it is almost impossible that the source file is recovered.</p><p><b>But you must be aware that this is not secure</b> on all file systems, and that parts of the file may have been saved in a temporary file or in the spooler of your printer if you previously opened it in an editor or tried to print it. Only works on files (not on folders).</p></qt>");
		  KActiveLabel *warn= new KActiveLabel( i18n("<a href=\"whatsthis:%1\">Read this before using shredding</a>").arg(shredWhatsThis),parentBox );
		  shredBox->addWidget(CBshred);
		  shredBox->addWidget(warn);
        }

	        CBsymmetric=new QCheckBox(i18n("Symmetrical encryption"),boutonboxoptions);
                QWhatsThis::add
                        (CBsymmetric,i18n("<b>Symmetrical encryption</b>: encryption does not use keys. You just need to give a password "
                                          "to encrypt/decrypt the file"));
                QObject::connect(CBsymmetric,SIGNAL(toggled(bool)),this,SLOT(isSymetric(bool)));

//.........这里部分代码省略.........
开发者ID:serghei,项目名称:kde3-kdeutils,代码行数:101,代码来源:popuppublic.cpp

示例7: QWidget

OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& startDir,
        OFileSelector* sel)
    : QWidget( parent ), m_sel( sel ) {
    m_all = false;
    QVBoxLayout* lay = new QVBoxLayout( this );
    m_currentDir = startDir;

    /*
     * now we add a special bar
     * One Button For Up
     * Home
     * Doc
     * And a dropdown menu with FileSystems
     * FUTURE: one to change dir with lineedit
     * Bookmarks
     * Create Dir
     */
    QHBox* box = new QHBox(this );
    box->setBackgroundMode( PaletteButton );
    box->setSpacing( 0 );

    QToolButton *btn = new QToolButton( box );
    btn->setIconSet( Resource::loadIconSet("up") );
    connect(btn, SIGNAL(clicked() ),
            this, SLOT( cdUP() ) );

    btn = new QToolButton( box );
    btn->setIconSet( Resource::loadIconSet("home") );
    connect(btn, SIGNAL(clicked() ),
            this, SLOT( cdHome() ) );

    btn = new QToolButton( box );
    btn->setIconSet( Resource::loadIconSet("DocsIcon") );
    connect(btn, SIGNAL(clicked() ),
            this, SLOT(cdDoc() ) );

    m_btnNew = new QToolButton( box );
    m_btnNew->setIconSet( Resource::loadIconSet("new") );
    connect(m_btnNew, SIGNAL(clicked() ),
            this, SLOT(slotNew() ) );


    m_btnClose = new QToolButton( box );
    m_btnClose->setIconSet( Resource::loadIconSet("close") );
    connect(m_btnClose, SIGNAL(clicked() ),
            selector(), SIGNAL(closeMe() ) );

    btn = new QToolButton( box );
    btn->setIconSet( Resource::loadIconSet("pcmcia") );

    /* let's fill device parts */
    QPopupMenu* pop = new QPopupMenu(this);
    connect(pop, SIGNAL( activated(int) ),
            this, SLOT(slotFSActivated(int) ) );

    StorageInfo storage;
    const QList<FileSystem> &fs = storage.fileSystems();
    QListIterator<FileSystem> it(fs);
    for ( ; it.current(); ++it ) {
        const QString disk = (*it)->name();
        const QString path = (*it)->path();
        m_dev.insert( disk, path );
        pop->insertItem( disk );
    }
    m_fsPop = pop;


    btn->setPopup( pop );

    lay->addWidget( box );

    m_view = new QListView( this );

    m_view->installEventFilter(this);

    QPEApplication::setStylusOperation( m_view->viewport(),
                                        QPEApplication::RightOnHold);
    m_view->addColumn(" " );
    m_view->addColumn(tr("Name"), 135 );
    m_view->addColumn(tr("Size"), -1 );
    m_view->addColumn(tr("Date"), 60 );
    m_view->addColumn(tr("Mime Type"), -1 );


    m_view->setSorting( 1 );
    m_view->setAllColumnsShowFocus( TRUE );

    lay->addWidget( m_view, 1000 );
    connectSlots();
}
开发者ID:opieproject,项目名称:opie,代码行数:90,代码来源:ofileselector.cpp


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