本文整理汇总了C++中QToolButton::setPixmap方法的典型用法代码示例。如果您正苦于以下问题:C++ QToolButton::setPixmap方法的具体用法?C++ QToolButton::setPixmap怎么用?C++ QToolButton::setPixmap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QToolButton
的用法示例。
在下文中一共展示了QToolButton::setPixmap方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CHotKeyEditorMenu
//.........这里部分代码省略.........
actionKillProcessAction = new CAction (tr("Kill Process"), getPixmapIcon("killProcessIcon"),
tr("&Kill Process"), Qt::CTRL + Qt::Key_K, this, "actionKillProcessAction");
actionKillProcessAction->setParentMenuText(tr("Action"));
connect(actionKillProcessAction, SIGNAL(activated()), this, SLOT(killProcesses()));
CAction * actionPingAction = new CAction (tr("Ping"), getPixmapIcon("pingIcon"),
tr("&Ping"), Qt::CTRL + Qt::Key_P, this, "actionPingAction");
actionPingAction->setParentMenuText(tr("Action"));
connect(actionPingAction, SIGNAL(activated()), this, SLOT(ping()));
CAction * actionShutdownAction = new CAction (tr("Shutdown"), getPixmapIcon("serverShutdownIcon"),
tr("&Shutdown"), 0, this, "actionShutdownAction");
actionShutdownAction->setParentMenuText(tr("Action"));
connect(actionShutdownAction, SIGNAL(activated()), this, SLOT(shutdown()));
fileTimerAction = new CAction (tr("Start Refresh Timer"), getPixmapIcon("timerIcon"),
tr("Start Refresh &Timer"), Qt::CTRL + Qt::Key_T, this, "fileTimerAction", true);
fileTimerAction->setParentMenuText(tr("File"));
connect(fileTimerAction, SIGNAL(toggled(bool)), this, SLOT(fileTimerActionToggled(bool)));
QPopupMenu *fileMenu = new QPopupMenu(this);
QPopupMenu *actionMenu = new QPopupMenu(this);
QPopupMenu *viewMenu = new QPopupMenu(this);
connect(viewMenu, SIGNAL(aboutToShow()), this, SLOT(viewMenuAboutToShow()));
fileMenu->insertItem(getPixmapIcon("saveIcon"), tr("Save"), save_menu);
fileMenu->insertSeparator();
fileRefreshAction->addTo(fileMenu);
fileMenu->insertSeparator();
fileTimerAction->addTo(fileMenu);
fileMenu->insertSeparator();
fileCloseAction->addTo(fileMenu);
menuBar()->insertItem(tr("&File"), fileMenu);
viewShowMessagesAction->addTo(viewMenu);
menuBar()->insertItem(tr("&View"), viewMenu);
actionKillProcessAction->addTo(actionMenu);
flush_menu = flushMenu(m_mysql->mysql());
connect(flush_menu, SIGNAL(activated(int)), this, SLOT(flush(int)));
actionMenu->insertItem(getPixmapIcon("flushIcon"),tr("Flush"), flush_menu);
actionPingAction->addTo(actionMenu);
actionMenu->insertSeparator();
actionShutdownAction->addTo(actionMenu);
menuBar()->insertItem(tr("&Action"), actionMenu);
new CHotKeyEditorMenu(this, menuBar(), "HotKeyEditor");
QToolBar * actionToolBar = new QToolBar(tr("Action Bar"), this, Top);
QToolButton * saveTypeButton = new QToolButton(actionToolBar);
saveTypeButton->setPopup(save_menu);
saveTypeButton->setPixmap(getPixmapIcon("saveIcon"));
saveTypeButton->setTextLabel(tr("Save"), true);
saveTypeButton->setPopupDelay(0);
actionToolBar->addSeparator();
actionKillProcessAction->addTo(actionToolBar);
QToolButton * flushTypeButton = new QToolButton(actionToolBar);
flushTypeButton->setPopup(flush_menu);
flushTypeButton->setPixmap(getPixmapIcon("flushIcon"));
flushTypeButton->setTextLabel(tr("Flush"), true);
flushTypeButton->setPopupDelay(0);
actionPingAction->addTo(actionToolBar);
actionToolBar->addSeparator();
actionShutdownAction->addTo(actionToolBar);
QToolBar * refreshToolBar = new QToolBar(tr("Refresh Bar"), this, Top );
fileRefreshAction->addTo(refreshToolBar);
refreshToolBar->addSeparator();
QLabel * delayLabel = new QLabel(refreshToolBar, "delayLabel" );
delayLabel->setMinimumSize(QSize(65, 0));
delayLabel->setText(tr("Refresh Rate (sec)"));
delay = new QSpinBox(refreshToolBar, "delayBox");
delay->setMinimumSize(QSize( 50, 0));
delay->setMaxValue(7200);
delay->setMinValue(1);
CConfig *cfg = new CConfig();
delay->setValue(cfg->readNumberEntry("Refresh Rate", 30));
status->setTraditionalMode(strtobool(cfg->readStringEntry("Status Traditional Mode", "true")));
delete cfg;
status->refresh();
fileTimerAction->addTo(refreshToolBar);
refreshTimer = new QTimer(this);
connect(refreshTimer, SIGNAL(timeout()), this, SLOT(refresh()));
connect(tabWidget, SIGNAL(currentChanged (QWidget *)), this, SLOT(tabChanged(QWidget *)));
myResize(600, 400);
}
示例2: QWidget
//The main constructor.
GofunWidget::GofunWidget(WFlags f) : QWidget(0,0,f)
{
//Set up some accelerators
accel = new QAccel(this);
//Do some layout magic
QHBoxLayout* hbox = new QHBoxLayout(this);
QVBoxLayout* vbox = new QVBoxLayout();
QHBoxLayout* hboxr = new QHBoxLayout();
QHBoxLayout* hboxlabel = new QHBoxLayout();
//This button group contains the buttons for the different directories
cats_bg = new GofunVButtonGroup(this);
cats_bg->setExclusive(true);
cats_bg->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Expanding,false);
connect(cats_bg, SIGNAL(clicked(int)),this, SLOT(changeDirectory(int)));
//We 'load' this WidgetStack with GofunIconViews later on
view_ws = new QWidgetStack(this);
view_ws->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding,false);
//It should be obvious what that is being
QPushButton* quit = new QPushButton(tr("Quit"), this, "quit");
quit->setFont(QFont("Times", 18));
quit->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum,false);
connect(quit, SIGNAL(clicked()), qApp, SLOT(quit()));
//The button marking your way to the settings-dialog
QToolButton* config = new QToolButton(this);
config->setPixmap(QPixmap("config.png"));
QToolTip::add(config,tr("Settings"));
connect(config, SIGNAL(clicked()),this, SLOT(openSettingsDlg()));
//A helpful help-button
QToolButton* help = new QToolButton(this);
help->setPixmap(QPixmap("help.png"));
QToolTip::add(help,tr("Help"));
connect(help, SIGNAL(clicked()),this, SLOT(showHelp()));
//Layout magic, basically we add the WidgetStack and a vertical box to the
//top horizontal box
hbox->addWidget(view_ws);
hbox->addLayout(vbox);
//Isn't it nice?
QLabel* gflabel = new QLabel("GoFun",this);
gflabel->setFont(QFont("Times",18, QFont::Bold));
gflabel->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum,0);
vbox->addLayout(hboxlabel);
hboxlabel->addWidget(gflabel);
//Common it is ...
QToolButton* gficon = new QToolButton(this);
gficon->setFixedWidth(32);
gficon->setPixmap(QPixmap("gofun.png"));
QToolTip::add(gficon,tr("About"));
hboxlabel->addWidget(gficon);
connect(gficon,SIGNAL(clicked()),this,SLOT(showAbout()));
//The last steps in our layout magic
vbox->addWidget(cats_bg);
tools_cat = new GofunDirectoryButton("GoTools",this);
vbox->addWidget(tools_cat);
QWidget* wid = new QWidget(this);
wid->setMinimumHeight(5);
vbox->addWidget(wid);
vbox->addLayout(hboxr);
hboxr->addWidget(quit);
hboxr->addWidget(config);
hboxr->addWidget(help);
//This toolbutton shall be used to add directories
QToolButton* cat_add = new QToolButton(Qt::DownArrow,cats_bg);
connect(cat_add, SIGNAL(clicked()),this, SLOT(popupDirectoryAdd()));
QToolTip::add(cat_add,tr("Click this button to operate on directories"));
cats_bg->insert(cat_add);
//Now load the whole GoFun-Data and care for its displaying
loadData();
}