本文整理汇总了C++中QToolButton类的典型用法代码示例。如果您正苦于以下问题:C++ QToolButton类的具体用法?C++ QToolButton怎么用?C++ QToolButton使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QToolButton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QWidget
CCustomer::CCustomer(QWidget *parent) :
QWidget(parent)
, actualRecords(false)
, ui(new Ui::CCustomer)
, customerDialog(new CCustomerDialog(this)), customer_gDialog(new CCustomer_gDialog(this))
, discountDialog(new CDiscountDialog(this))
, addItem(new CAddItem(this))
, focusedWidget(nullptr)
{
ui->setupUi(this);
// model
modelFaces = new QStandardItemModel(this);
modelPartner = new QStandardItemModel(this);
modelHuman = new QStandardItemModel(this);
modelSelectionFaces = new QItemSelectionModel(modelFaces);
modelSelectionPartner = new QItemSelectionModel(modelPartner);
modelSelectionHuman = new QItemSelectionModel(modelHuman);
// create #temporary table
QString query ("SELECT * INTO #GroupCustomerDiscounts FROM ViewGroupCustomerDiscounts"
"SELECT * INTO #CustomerSubdiller FROM ViewCustomerSubdiller");
QSqlQuery temporary(currentDatabase());
temporary.exec(query);
QSplitter *hSplitter = new QSplitter(Qt::Horizontal);
QSplitter *vSplitter = new QSplitter(Qt::Vertical);
QWidget *w1 = new QWidget(this);
QWidget *w2 = new QWidget(this);
treeFaces = new QTreeView (this);
treePartner = new CCustomerTreeView (this);
textEditPartnerComment = new QTextEdit (this);
textEditPartnerComment->setMaximumWidth(100);
textEditPartnerComment->setReadOnly(true);
treeHuman = new CCustomerTreeView (this);
textEditHumanComment = new QTextEdit (this);
textEditHumanComment->setMaximumWidth(100);
textEditHumanComment->setReadOnly(true);
QHBoxLayout *hboxPartner = new QHBoxLayout(w1);
hboxPartner->setMargin(0);
hboxPartner->addWidget(treePartner);
hboxPartner->addWidget(textEditPartnerComment);
QHBoxLayout *hboxHuman = new QHBoxLayout(w2);
hboxHuman->setMargin(0);
hboxHuman->addWidget(treeHuman);
hboxHuman->addWidget(textEditHumanComment);
vSplitter->addWidget(w1);
vSplitter->addWidget(w2);
vSplitter->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
ui->vLayoutUnionPartnerHuman->addWidget(vSplitter);
hSplitter->addWidget(treeFaces);
hSplitter->addWidget(vSplitter);
hSplitter->setStretchFactor(1, 3);
hSplitter->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
ui->hLayoutUnionViews->addWidget(hSplitter);
treeFaces->setObjectName("treeViewFaces");
treeFaces->setModel(modelFaces);
treeFaces->setSelectionModel(modelSelectionFaces);
treeFaces->setEditTriggers(QAbstractItemView::NoEditTriggers);
treeFaces->installEventFilter(this);
treePartner->setObjectName("treeViewPartner");
treePartner->setRootIsDecorated(false);
treePartner->setAlternatingRowColors(true);
treePartner->setModel(modelPartner);
treePartner->setSelectionModel(modelSelectionPartner);
treePartner->setEditTriggers(QAbstractItemView::NoEditTriggers);
treePartner->installEventFilter(this);
treeHuman->setObjectName("treeViewHuman");
treeHuman->setRootIsDecorated(false);
treeHuman->setAlternatingRowColors(true);
treeHuman->setModel(modelHuman);
treeHuman->setSelectionModel(modelSelectionHuman);
treeHuman->setEditTriggers(QAbstractItemView::NoEditTriggers);
treeHuman->installEventFilter(this);
filter = new CFilter(this);
filter->setObjectName("filter");
filter->setPlaceholderText("Введите наименование");
filter->installEventFilter(this);
filter->setValidator(new QRegExpValidator(QRegExp(trUtf8("[а-яА-Яa-zA-Z0-9_]+")), this));
ui->hLayoutSearchToItem->addWidget(filter);
QToolButton *telephone = new QToolButton(this);
QPixmap pixmapTelephone("data/picture/additionally/telephone.png");
telephone->setIcon(QIcon(pixmapTelephone));
telephone->setIconSize(QSize(24, 24));
telephone->setCursor(Qt::PointingHandCursor);
//.........这里部分代码省略.........
示例2: QMainWindow
//.........这里部分代码省略.........
mapMenu->addAction("&Generate Paint Cells", mapEditor, SLOT(generatePaint()));
mapMenu->addAction("&Clear Paint Cells", mapEditor, SLOT(clearPaint()));
mapMenu->addSeparator();
mapMenu->addAction("&Generate Path Progression", mapEditor, SLOT(generatePathProgress()));
mapMenu->addAction("&Generate 2D Map", this, SLOT(save2DMapImage()));
mapMenu->addSeparator();
mapMenu->addAction("&Load Cube Map", mapEditor, SLOT(loadCubeMap()));
mapMenu->addSeparator();
mapMenu->addAction("&Load Prop Mesh", this, SLOT(loadPropMesh()));
mapMenu->addAction("&Remove Prop Mesh", mapEditor, SLOT(removePropMesh()));
mapMenu->addSeparator();
mapMenu->addAction("&Translate All Map Objects", this, SLOT(translateAll()));
mapMenu->addAction("&Scale All Map Objects", this, SLOT(scaleAll()));
menuBar->addMenu(fileMenu);
menuBar->addMenu(editMenu);
menuBar->addMenu(viewMenu);
menuBar->addMenu(meshMenu);
menuBar->addMenu(mapMenu);
setMenuBar(menuBar);
/*Options Toolbar*************************************************************/
optionsFrame = new QFrame(this);
optionsBar = new QToolBar(this);
QHBoxLayout* viewing_layout = new QHBoxLayout(this);
QHBoxLayout* options_layout = new QHBoxLayout(this);
QHBoxLayout* objects_layout = new QHBoxLayout(this);
QHBoxLayout* edit_mode_layout = new QHBoxLayout(this);
QHBoxLayout* prop_mesh_layout = new QHBoxLayout(this);
//Viewing buttons
QToolButton* advancedRenderingButton = new QToolButton(this);
advancedRenderingButton->setDefaultAction(advancedRenderingAction);
advancedRenderingButton->setIconSize(QSize(32, 32));
QToolButton* orthoCameraButton = new QToolButton(this);
orthoCameraButton->setDefaultAction(orthoCameraAction);
orthoCameraButton->setIconSize(QSize(32, 32));
QToolButton* showPaintButton = new QToolButton(this);
showPaintButton->setDefaultAction(showPaintAction);
showPaintButton->setIconSize(QSize(32, 32));
QToolButton* showInvisibleButton = new QToolButton(this);
showInvisibleButton->setDefaultAction(showInvisibleAction);
showInvisibleButton->setIconSize(QSize(32, 32));
viewing_layout->addWidget(advancedRenderingButton);
viewing_layout->addWidget(orthoCameraButton);
viewing_layout->addWidget(showPaintButton);
viewing_layout->addWidget(showInvisibleButton);
viewing_layout->setAlignment(Qt::AlignLeft);
//Object buttons
for (int i = 0; i < MapObject::NUM_OBJECT_TYPES; i++) {
QToolButton* object_button = new QToolButton(this);
object_button->setDefaultAction(mapObjectAction[i]);
object_button->setIconSize(QSize(32, 32));
objects_layout->addWidget(object_button);
}
示例3: QWidgetAction
void MusicSystemTrayMenu::createPlayWidgetActions()
{
m_widgetAction = new QWidgetAction(this);
QWidget *widgetActionContainer = new QWidget(this);
QVBoxLayout *vbox = new QVBoxLayout(widgetActionContainer);
vbox->setMargin(0);
QWidget *widgetContainer = new QWidget(widgetActionContainer);
QHBoxLayout *box = new QHBoxLayout(widgetContainer);
box->setMargin(0);
QToolButton *previousPlay = new QToolButton(widgetContainer);
QToolButton *nextPlay = new QToolButton(widgetContainer);
m_PlayOrStop = new QToolButton(widgetContainer);
previousPlay->setIcon(QIcon(QString::fromUtf8(":/contextMenu/sysprevious")));
nextPlay->setIcon(QIcon(QString::fromUtf8(":/contextMenu/sysnext")));
m_PlayOrStop->setIcon(QIcon(QString::fromUtf8(":/contextMenu/sysplay")));
previousPlay->setIconSize(QSize(40, 40));
nextPlay->setIconSize(QSize(40, 40));
m_PlayOrStop->setIconSize(QSize(45, 45));
previousPlay->setStyleSheet(MusicUIObject::MToolButtonStyle01);
nextPlay->setStyleSheet(MusicUIObject::MToolButtonStyle01);
m_PlayOrStop->setStyleSheet(MusicUIObject::MToolButtonStyle01);
previousPlay->setCursor(QCursor(Qt::PointingHandCursor));
nextPlay->setCursor(QCursor(Qt::PointingHandCursor));
m_PlayOrStop->setCursor(QCursor(Qt::PointingHandCursor));
previousPlay->setToolTip(tr("Previous"));
nextPlay->setToolTip(tr("Next"));
m_PlayOrStop->setToolTip(tr("Play"));
box->addWidget(previousPlay);
box->addWidget(m_PlayOrStop);
box->addWidget(nextPlay);
m_showText = new QLabel(widgetActionContainer);
m_showText->setAlignment(Qt::AlignCenter);
m_showText->setStyleSheet(MusicUIObject::MCustomStyle12);
vbox->addWidget(widgetContainer);
vbox->addWidget(m_showText);
widgetActionContainer->setLayout(vbox);
m_widgetAction->setDefaultWidget(widgetActionContainer);
connect(previousPlay, SIGNAL(clicked()), parent(), SLOT(musicPlayPrevious()));
connect(nextPlay, SIGNAL(clicked()), parent(), SLOT(musicPlayNext()));
connect(m_PlayOrStop, SIGNAL(clicked()), parent(), SLOT(musicStatePlay()));
}
示例4: QMainWindow
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->textBrowser->setText("Bienvenue dans MediaInfo");
C = new Core();
settings = new QSettings("MediaArea.net","MediaInfo");
defaultSettings();
applySettings();
view = (ViewMode)settings->value("defaultView",VIEW_EASY).toInt();
// View menu:
QActionGroup* menuItemGroup = new QActionGroup(this);
for(int v=VIEW_EASY;v<NB_VIEW;v++) {
QAction* action = new QAction(nameView((ViewMode)v),ui->menuView);
action->setCheckable(true);
if(view==v)
action->setChecked(true);
action->setProperty("view",v);
ui->menuView->addAction(action);
menuItemGroup->addAction(action);
}
connect(menuItemGroup,SIGNAL(selected(QAction*)),SLOT(actionView_toggled(QAction*)));
menuItemGroup->setParent(ui->menuView);
QToolButton* tb = new QToolButton(ui->toolBar);
tb->setMenu(ui->menuView);
tb->setText("view");
tb->setPopupMode(QToolButton::InstantPopup);
tb->setIcon(QIcon(":/icon/view.svg"));
connect(ui->toolBar,SIGNAL(toolButtonStyleChanged(Qt::ToolButtonStyle)),tb,SLOT(setToolButtonStyle(Qt::ToolButtonStyle)));
ui->toolBar->addWidget(tb);
ui->toolBar->setContextMenuPolicy(Qt::CustomContextMenu);
this->connect(ui->toolBar,SIGNAL(customContextMenuRequested(QPoint)),SLOT(toolBarOptions(QPoint)));
/* TODO
QIcon::setThemeName("gnome-dust");
ui->actionQuit->setIcon(QIcon::fromTheme("application-exit"));
ui->actionOpen->setIcon(QIcon::fromTheme("document-open",QIcon(":/icon/openfile.svg")));
ui->actionExport->setIcon(QIcon::fromTheme("document-save",QIcon(":/icon/export.svg")));
ui->actionAbout->setIcon(QIcon::fromTheme("help-about",QIcon(":/icon/about.svg")));
*/
timer=NULL;
progressDialog=NULL;
refreshDisplay();
if(QCoreApplication::arguments().count()>1) {
QStringList files = QCoreApplication::arguments();
files.removeAt(0);
openFiles(files);
}
/*
qDebug() << "0.7 " << "0.7.5 " << isNewer("0.7","0.7.5");
qDebug() << "0.7.4 " << "0.7.5 " << isNewer("0.7.4","0.7.5");
qDebug() << "0.7.5 " << "0.7.4 " << isNewer("0.7.5","0.7.4");
qDebug() << "0.7.4 " << "0.7 " << isNewer("0.7.4","0.7");
qDebug() << "0.7.5 " << "0.7.5 " << isNewer("0.7.5","0.7.5");
*/
#ifdef NEW_VERSION
if(settings->value("checkForNewVersion",true).toBool()) {
checkForNewVersion();
}
#endif
}
示例5: renderModeMenuPressed
void EFFEditorScenePanel::renderModeMenuPressed(QAction * action)
{
QToolButton * renderMode = qobject_cast<QToolButton *>(action->parentWidget()->parentWidget());
renderMode->setText(action->text());
}
示例6: Dialog
//.........这里部分代码省略.........
m_oTlvSeparator = new Separator(tr("TLV Levels"));
m_paramsLayout->addWidget(m_oTlvSeparator, row++, 0, 1, 2);
//Tone Threshold
m_oToneThresholdLabel = new QLabel(tr("Tone Threshold"));
m_oToneThreshold = new IntField(this);
m_paramsLayout->addWidget(m_oToneThresholdLabel, row, 0, Qt::AlignRight);
m_paramsLayout->addWidget(m_oToneThreshold, row++, 1);
locals.addParameter(l_outlineParamGroups, tr("Tone Threshold"));
m_paramsLayout->setRowStretch(row, 1);
//-------------------- Swatch area ------------------------
m_swatchArea = new VectorizerSwatchArea(this);
splitter->addWidget(m_swatchArea);
m_swatchArea->setEnabled(false); //Initally not enabled
connect(this, SIGNAL(valuesChanged()), m_swatchArea, SLOT(invalidateContents()));
//---------------------- Toolbar --------------------------
QAction *swatchAct = new QAction(createQIconOnOffPNG("preview", true), tr("Toggle Swatch Preview"), this);
swatchAct->setCheckable(true);
leftToolBar->addAction(swatchAct);
QAction *centerlineAct = new QAction(createQIconOnOffPNG("opacitycheck", true), tr("Toggle Centerlines Check"), this);
centerlineAct->setCheckable(true);
leftToolBar->addAction(centerlineAct);
QToolButton *visibilityButton = new QToolButton(this);
visibilityButton->setIcon(createQIconPNG("options"));
visibilityButton->setPopupMode(QToolButton::InstantPopup);
QMenu *visibilityMenu = new QMenu(visibilityButton);
visibilityButton->setMenu(visibilityMenu);
rightToolBar->addWidget(visibilityButton);
rightToolBar->addSeparator();
QAction *saveAct = new QAction(createQIconOnOffPNG("save", false), tr("Save Settings"), this);
rightToolBar->addAction(saveAct);
QAction *loadAct = new QAction(createQIconOnOffPNG("load", false), tr("Load Settings"), this);
rightToolBar->addAction(loadAct);
rightToolBar->addSeparator();
QAction *resetAct = new QAction(createQIconOnOffPNG("resetsize", false), tr("Reset Settings"), this);
rightToolBar->addAction(resetAct);
connect(swatchAct, SIGNAL(triggered(bool)), m_swatchArea, SLOT(enablePreview(bool)));
connect(centerlineAct, SIGNAL(triggered(bool)), m_swatchArea, SLOT(enableDrawCenterlines(bool)));
connect(visibilityMenu, SIGNAL(aboutToShow()), this, SLOT(populateVisibilityMenu()));
connect(saveAct, SIGNAL(triggered()), this, SLOT(saveParameters()));
connect(loadAct, SIGNAL(triggered()), this, SLOT(loadParameters()));
connect(resetAct, SIGNAL(triggered()), this, SLOT(resetParameters()));
//------------------- Convert Button ----------------------
//Convert Button
m_okBtn = new QPushButton(QString(tr("Convert")), this);
connect(m_okBtn, SIGNAL(clicked()), this, SLOT(onOk()));
addButtonBarWidget(m_okBtn);
示例7: QWidget
FindBar::FindBar(QWidget *parent)
: QWidget(parent)
, m_lineEdit(new QLineEdit(this))
, m_matchCase(new QCheckBox(tr("&Match case"), this))
, m_highlightAll(new QCheckBox(tr("&Highlight all"), this)),
m_associatedWebView(0)
{
QHBoxLayout *layout = new QHBoxLayout;
// cosmetic
layout->setContentsMargins(2, 0, 2, 0);
// hide button
QToolButton *hideButton = new QToolButton(this);
hideButton->setAutoRaise(true);
hideButton->setIcon(QIcon::fromTheme(QLatin1String("dialog-close")));
hideButton->setShortcut(tr("Esc"));
connect(hideButton, SIGNAL(clicked()), this, SLOT(hide()));
layout->addWidget(hideButton);
layout->setAlignment(hideButton, Qt::AlignLeft | Qt::AlignTop);
// label
QLabel *label = new QLabel(tr("Find:"));
layout->addWidget(label);
// Find Bar signal
connect(this, SIGNAL(searchString(QString)), this, SLOT(find(QString)));
// lineEdit, focusProxy
setFocusProxy(m_lineEdit);
m_lineEdit->setMaximumWidth(250);
connect(m_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(find(QString)));
layout->addWidget(m_lineEdit);
// buttons
QPushButton *findNext = new QPushButton(QIcon::fromTheme(QLatin1String("go-down")), tr("&Next"), this);
findNext->setShortcut(tr("F3"));
QPushButton *findPrev = new QPushButton(QIcon::fromTheme(QLatin1String("go-up")), tr("&Previous"), this);
findPrev->setShortcut(tr("Shift+F3"));
connect(findNext, SIGNAL(clicked()), this, SLOT(findNext()));
connect(findPrev, SIGNAL(clicked()), this, SLOT(findPrevious()));
layout->addWidget(findNext);
layout->addWidget(findPrev);
// Case sensitivity. Deliberately set so this is off by default.
m_matchCase->setCheckState(Qt::Unchecked);
m_matchCase->setTristate(false);
connect(m_matchCase, SIGNAL(toggled(bool)), this, SLOT(matchCaseUpdate()));
layout->addWidget(m_matchCase);
// Hightlight All. On by default
m_highlightAll->setCheckState(Qt::Checked);
m_highlightAll->setTristate(false);
connect(m_highlightAll, SIGNAL(toggled(bool)), this, SLOT(updateHighlight()));
layout->addWidget(m_highlightAll);
// stretching widget on the left
layout->addStretch();
setLayout(layout);
// we start off hidden
hide();
}
示例8: QWidget
//-----------------------------------------------------------------------------
MemPanel::MemPanel(QWidget *parent) : QWidget(parent)
{
QHBoxLayout *h;
QVBoxLayout *v;
QToolButton *b;
infoDlg = new InfoDialog(this);
infoDlg->setModal(true); infoDlg->allowRefresh=false;
v = new QVBoxLayout(this); h = new QHBoxLayout(); v->addLayout(h);
b = new QToolButton(this); b->setIcon(QPixmap(":/png/document-new.png"));
b->setToolTip(tr("Create new data array")); h->addWidget(b);
connect(b, SIGNAL(clicked()), this, SLOT(newTable()));
b = new QToolButton(this); b->setIcon(QPixmap(table_xpm));
b->setToolTip(tr("Edit selected data array")); h->addWidget(b);
connect(b, SIGNAL(clicked()), this, SLOT(editData()));
b = new QToolButton(this); b->setIcon(QPixmap(":/png/edit-delete.png"));
b->setToolTip(tr("Delete selected data array")); h->addWidget(b);
connect(b, SIGNAL(clicked()), this, SLOT(delData()));
b = new QToolButton(this); b->setIcon(QPixmap(preview_xpm));
b->setToolTip(tr("Properties of selected data array")); h->addWidget(b);
connect(b, SIGNAL(clicked()), this, SLOT(infoData()));
b = new QToolButton(this); b->setIcon(QPixmap(":/png/view-refresh.png"));
b->setToolTip(tr("Update list of data arrays")); h->addWidget(b);
connect(b, SIGNAL(clicked()), this, SLOT(refresh()));
h->addStretch(1);
b = new QToolButton(this); b->setIcon(QPixmap(":/png/edit-clear.png"));
b->setToolTip(tr("Delete ALL data arrays")); h->addWidget(b);
connect(b, SIGNAL(clicked()), this, SLOT(delAllData()));
colSort = 0;
tab = new QTableWidget(this); tab->setColumnCount(3); v->addWidget(tab);
QStringList sl; sl<<tr("Name")<<tr("Sizes")<<tr("Memory");
tab->setHorizontalHeaderLabels(sl);
connect(tab, SIGNAL(cellClicked(int,int)), this, SLOT(tableClicked(int,int)));
connect(tab, SIGNAL(cellDoubleClicked(int,int)), this, SLOT(tableDClicked(int,int)));
setWindowTitle(tr("Memory"));
}
示例9: QWidget
StartupView::StartupView( QWidget * parent )
: QWidget( parent )
{
m_templateListModel = boost::shared_ptr<TemplateListModel>( new TemplateListModel() );
setStyleSheet("openstudio--StartupView { background: #E6E6E6; }");
#ifdef Q_WS_MAC
setWindowFlags(Qt::FramelessWindowHint);
#else
setWindowFlags(Qt::CustomizeWindowHint);
#endif
QWidget * recentProjectsView = new QWidget();
recentProjectsView->setStyleSheet("QWidget { background: #F2F2F2; }");
QVBoxLayout * recentProjectsLayout = new QVBoxLayout();
recentProjectsLayout->setContentsMargins(10,10,10,10);
QLabel * recentProjectsLabel = new QLabel("Recent Projects");
recentProjectsLabel->setStyleSheet("QLabel { font: bold }");
recentProjectsLayout->addWidget(recentProjectsLabel,0,Qt::AlignTop);
recentProjectsView->setLayout(recentProjectsLayout);
QToolButton * openButton = new QToolButton();
openButton->setText("Open File");
openButton->setStyleSheet("QToolButton { font: bold; }");
openButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
QIcon openIcon(":/images/open_file.png");
openButton->setIcon(openIcon);
openButton->setIconSize(QSize(40,40));
connect( openButton, SIGNAL(clicked()), this, SIGNAL(openClicked()) );
QToolButton * importButton = new QToolButton();
importButton->setText("Import Idf");
importButton->setStyleSheet("QToolButton { font: bold; }");
importButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
QIcon importIcon(":/images/import_file.png");
importButton->setIcon(importIcon);
importButton->setIconSize(QSize(40,40));
connect( importButton, SIGNAL(clicked()), this, SIGNAL(importClicked()) );
/*
QToolButton * importSDDButton = new QToolButton();
importSDDButton->setText("Import SDD");
importSDDButton->setStyleSheet("QToolButton { font: bold; }");
importSDDButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
QIcon importSDDIcon(":/images/import_file.png");
importSDDButton->setIcon(importSDDIcon);
importSDDButton->setIconSize(QSize(40,40));
connect( importSDDButton, SIGNAL(clicked()), this, SIGNAL(importSDDClicked()) );
*/
QWidget * projectChooserView = new QWidget();
projectChooserView->setFixedWidth(238);
projectChooserView->setStyleSheet("QWidget { background: #F2F2F2; }");
QVBoxLayout * projectChooserLayout = new QVBoxLayout();
projectChooserLayout->setContentsMargins(10,10,10,10);
QLabel * projectChooserLabel = new QLabel("Create New From Template");
projectChooserLabel->setStyleSheet("QLabel { font: bold }");
projectChooserLayout->addWidget(projectChooserLabel,0,Qt::AlignTop);
m_listView = new QListView();
m_listView->setViewMode(QListView::IconMode);
m_listView->setModel(m_templateListModel.get());
m_listView->setFocusPolicy(Qt::NoFocus);
m_listView->setFlow(QListView::LeftToRight);
m_listView->setUniformItemSizes(true);
m_listView->setSelectionMode(QAbstractItemView::SingleSelection);
projectChooserLayout->addWidget(m_listView);
projectChooserView->setLayout(projectChooserLayout);
m_projectDetailView = new QWidget();
m_projectDetailView->setStyleSheet("QWidget { background: #F2F2F2; }");
QVBoxLayout * projectDetailLayout = new QVBoxLayout();
projectDetailLayout->setContentsMargins(10,10,10,10);
m_projectDetailView->setLayout(projectDetailLayout);
QWidget * footerView = new QWidget();
footerView->setObjectName("FooterView");
footerView->setStyleSheet("QWidget#FooterView { background: #E6E6E6; }");
footerView->setMaximumHeight(50);
footerView->setMinimumHeight(50);
QPushButton * cancelButton = new QPushButton();
cancelButton->setObjectName("StandardGrayButton");
cancelButton->setMinimumSize(QSize(99,28));
#ifdef OPENSTUDIO_PLUGIN
cancelButton->setText("Cancel");
connect( cancelButton, SIGNAL(clicked()), this, SLOT(hide()) );
#else
#ifdef Q_OS_MAC
cancelButton->setText("Quit");
#else
cancelButton->setText("Exit");
#endif
connect( cancelButton, SIGNAL(clicked()), OpenStudioApp::instance(), SLOT(quit()) );
#endif
cancelButton->setStyleSheet("QPushButton { font: bold; }");
QPushButton * chooseButton = new QPushButton();
chooseButton->setObjectName("StandardBlueButton");
chooseButton->setText("Choose");
chooseButton->setMinimumSize(QSize(99,28));
connect( chooseButton, SIGNAL(clicked()), this, SLOT(newFromTemplateSlot()) );
//.........这里部分代码省略.........
示例10: QWidget
QbsRunConfigurationWidget::QbsRunConfigurationWidget(QbsRunConfiguration *rc, QWidget *parent)
: QWidget(parent),
m_rc(rc),
m_ignoreChange(false),
m_isShown(false)
{
QVBoxLayout *vboxTopLayout = new QVBoxLayout(this);
vboxTopLayout->setMargin(0);
QHBoxLayout *hl = new QHBoxLayout();
hl->addStretch();
m_disabledIcon = new QLabel(this);
m_disabledIcon->setPixmap(QPixmap(QLatin1String(":/projectexplorer/images/compile_warning.png")));
hl->addWidget(m_disabledIcon);
m_disabledReason = new QLabel(this);
m_disabledReason->setVisible(false);
hl->addWidget(m_disabledReason);
hl->addStretch();
vboxTopLayout->addLayout(hl);
m_detailsContainer = new Utils::DetailsWidget(this);
m_detailsContainer->setState(Utils::DetailsWidget::NoSummary);
vboxTopLayout->addWidget(m_detailsContainer);
QWidget *detailsWidget = new QWidget(m_detailsContainer);
m_detailsContainer->setWidget(detailsWidget);
QFormLayout *toplayout = new QFormLayout(detailsWidget);
toplayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
toplayout->setMargin(0);
m_executableLineEdit = new QLineEdit(this);
m_executableLineEdit->setEnabled(false);
m_executableLineEdit->setPlaceholderText(tr("<unknown>"));
toplayout->addRow(tr("Executable:"), m_executableLineEdit);
QLabel *argumentsLabel = new QLabel(tr("Arguments:"), this);
m_argumentsLineEdit = new QLineEdit(m_rc->rawCommandLineArguments(), this);
argumentsLabel->setBuddy(m_argumentsLineEdit);
toplayout->addRow(argumentsLabel, m_argumentsLineEdit);
m_workingDirectoryEdit = new Utils::PathChooser(this);
m_workingDirectoryEdit->setHistoryCompleter(QLatin1String("Qbs.WorkingDir.History"));
m_workingDirectoryEdit->setExpectedKind(Utils::PathChooser::Directory);
ProjectExplorer::EnvironmentAspect *aspect
= m_rc->extraAspect<ProjectExplorer::EnvironmentAspect>();
if (aspect) {
connect(aspect, SIGNAL(environmentChanged()), this, SLOT(environmentWasChanged()));
environmentWasChanged();
}
m_workingDirectoryEdit->setPromptDialogTitle(tr("Select Working Directory"));
QToolButton *resetButton = new QToolButton(this);
resetButton->setToolTip(tr("Reset to default"));
resetButton->setIcon(QIcon(QLatin1String(Core::Constants::ICON_RESET)));
QHBoxLayout *boxlayout = new QHBoxLayout();
boxlayout->setMargin(0);
boxlayout->addWidget(m_workingDirectoryEdit);
boxlayout->addWidget(resetButton);
toplayout->addRow(tr("Working directory:"), boxlayout);
QHBoxLayout *innerBox = new QHBoxLayout();
m_useTerminalCheck = new QCheckBox(tr("Run in terminal"), this);
innerBox->addWidget(m_useTerminalCheck);
innerBox->addStretch();
toplayout->addRow(QString(), innerBox);
runConfigurationEnabledChange();
connect(m_workingDirectoryEdit, SIGNAL(changed(QString)),
this, SLOT(workDirectoryEdited()));
connect(resetButton, SIGNAL(clicked()),
this, SLOT(workingDirectoryWasReset()));
connect(m_argumentsLineEdit, SIGNAL(textEdited(QString)),
this, SLOT(argumentsEdited(QString)));
connect(m_useTerminalCheck, SIGNAL(toggled(bool)),
this, SLOT(termToggled(bool)));
connect(m_rc, SIGNAL(baseWorkingDirectoryChanged(QString)),
this, SLOT(workingDirectoryChanged(QString)));
connect(m_rc, SIGNAL(commandLineArgumentsChanged(QString)),
this, SLOT(commandLineArgumentsChanged(QString)));
connect(m_rc, SIGNAL(runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode)),
this, SLOT(runModeChanged(ProjectExplorer::LocalApplicationRunConfiguration::RunMode)));
connect(m_rc, SIGNAL(targetInformationChanged()),
this, SLOT(targetInformationHasChanged()), Qt::QueuedConnection);
connect(m_rc, SIGNAL(enabledChanged()),
this, SLOT(runConfigurationEnabledChange()));
}
示例11: QToolButton
QWidget* GCF::ActionContainerWidget::createWidget(QAction* action, int rowSpan, int colSpan)
{
QWidget* ret = 0;
int gSize=int((fontMetrics().height()+fontMetrics().ascent())*1.2);
int minWidth = gSize*colSpan;
QWidgetAction* wAction = qobject_cast<QWidgetAction*>(action);
if(wAction)
ret = wAction->requestWidget(this);
else
{
QToolButton* tb = new QToolButton(this);
tb->setDefaultAction(action);
tb->setAutoRaise(true);
/*if(action->menu())
tb->setMenu(action->menu());*/
tb->setIconSize(QSize(gSize-4,gSize-4));
if(action->icon().isNull())
tb->setToolButtonStyle(Qt::ToolButtonTextOnly);
else if(colSpan == rowSpan && colSpan >= 2)
tb->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
else if(colSpan == rowSpan && colSpan == 1)
tb->setToolButtonStyle(Qt::ToolButtonIconOnly);
else if(colSpan >= 2 || rowSpan == 1)
tb->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
else if(rowSpan >= 3)
tb->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
int mw = 0;
if(tb->toolButtonStyle() != Qt::ToolButtonIconOnly)
mw += fontMetrics().width(action->iconText())+2*fontMetrics().width("_");
if(!action->icon().isNull())
{
switch(tb->toolButtonStyle())
{
case Qt::ToolButtonTextUnderIcon:
if(mw < gSize-4)
mw = gSize-4;
break;
case Qt::ToolButtonTextBesideIcon:
mw += gSize-4;
break;
}
}
if(minWidth < mw)
minWidth = mw;
if(action->menu())
{
// Connect the default action object to the tool button. This way
// when the toolbutton with menu is clicked, the default action is
// shown.
QList<QAction*> actions = action->menu()->actions();
QAction* defAction = 0;
for(int i=0; i<actions.count(); i++)
{
QAction* action = actions[i];
QList<QByteArray> propNames = action->dynamicPropertyNames();
if(propNames.contains("_default_"))
{
bool val = action->property("_default_").toBool();
if(val)
{
defAction = action;
break;
}
}
}
if(defAction)
{
if(defAction->isCheckable())
connect(tb, SIGNAL(clicked()), defAction, SLOT(toggle()));
else
connect(tb, SIGNAL(clicked()), defAction, SLOT(trigger()));
QFont font = defAction->font();
font.setBold(true);
defAction->setFont(font);
}
}
ret = tb;
}
ret->setMinimumSize(minWidth, gSize*rowSpan);
if(!action->icon().isNull())
{
QFont font = ret->font();
// font.setPointSize(font.pointSize()-1);
ret->setFont(font);
}
/*static QPlastiqueStyle Style;
ret->setStyle(&Style);*/
return ret;
//.........这里部分代码省略.........
示例12: Q_UNUSED
bool QgsCustomizationDialog::switchWidget( QWidget *widget, QMouseEvent *e )
{
Q_UNUSED( e );
QgsDebugMsg( "Entered" );
if ( !actionCatch->isChecked() )
return false;
QString path = widgetPath( widget );
QgsDebugMsg( "path = " + path );
if ( path.startsWith( "/QgsCustomizationDialogBase" ) )
{
// do not allow modification of this dialog
return false;
}
else if ( path.startsWith( "/QgisApp" ) )
{
// changes to main window
// (work with toolbars, tool buttons)
if ( widget->inherits( "QToolBar" ) )
{
path = "/Toolbars/" + widget->objectName();
}
else if ( widget->inherits( "QToolButton" ) )
{
QToolButton* toolbutton = qobject_cast<QToolButton*>( widget );
QAction* action = toolbutton->defaultAction();
if ( !action )
return false;
QString toolbarName = widget->parent()->objectName();
QString actionName = action->objectName();
path = "/Toolbars/" + toolbarName + "/" + actionName;
}
else
{
// unsupported widget in main window
return false;
}
}
else
{
// ordinary widget in a dialog
path = "/Widgets" + path;
}
QgsDebugMsg( "path final = " + path );
bool on = !itemChecked( path );
QgsDebugMsg( QString( "on = %1" ).arg( on ) );
setItemChecked( path, on );
QTreeWidgetItem *myItem = item( path );
if ( myItem )
{
treeWidget->scrollToItem( myItem, QAbstractItemView::PositionAtCenter );
treeWidget->clearSelection();
myItem->setSelected( true );
QString style;
if ( !on )
{
style = "background-color: #FFCCCC;";
}
widget->setStyleSheet( style );
}
return true;
}
示例13: Tab
TabRoom::TabRoom(TabSupervisor *_tabSupervisor, AbstractClient *_client, ServerInfo_User *_ownUser, const ServerInfo_Room &info)
: Tab(_tabSupervisor), client(_client), roomId(info.room_id()), roomName(QString::fromStdString(info.name())), ownUser(_ownUser)
{
const int gameTypeListSize = info.gametype_list_size();
for (int i = 0; i < gameTypeListSize; ++i)
gameTypes.insert(info.gametype_list(i).game_type_id(), QString::fromStdString(info.gametype_list(i).description()));
QMap<int, GameTypeMap> tempMap;
tempMap.insert(info.room_id(), gameTypes);
gameSelector = new GameSelector(client, tabSupervisor, this, QMap<int, QString>(), tempMap, true, true);
userList = new UserList(tabSupervisor, client, UserList::RoomList);
connect(userList, SIGNAL(openMessageDialog(const QString &, bool)), this, SIGNAL(openMessageDialog(const QString &, bool)));
chatView = new ChatView(tabSupervisor, 0, true);
connect(chatView, SIGNAL(showMentionPopup(QString&)), this, SLOT(actShowMentionPopup(QString&)));
connect(chatView, SIGNAL(messageClickedSignal()), this, SLOT(focusTab()));
connect(chatView, SIGNAL(openMessageDialog(QString, bool)), this, SIGNAL(openMessageDialog(QString, bool)));
connect(chatView, SIGNAL(showCardInfoPopup(QPoint, QString)), this, SLOT(showCardInfoPopup(QPoint, QString)));
connect(chatView, SIGNAL(deleteCardInfoPopup(QString)), this, SLOT(deleteCardInfoPopup(QString)));
connect(chatView, SIGNAL(addMentionTag(QString)), this, SLOT(addMentionTag(QString)));
connect(settingsCache, SIGNAL(chatMentionCompleterChanged()), this, SLOT(actCompleterChanged()));
sayLabel = new QLabel;
sayEdit = new LineEditCompleter;
sayLabel->setBuddy(sayEdit);
connect(sayEdit, SIGNAL(returnPressed()), this, SLOT(sendMessage()));
QMenu *chatSettingsMenu = new QMenu(this);
aClearChat = chatSettingsMenu->addAction(QString());
connect(aClearChat, SIGNAL(triggered()), this, SLOT(actClearChat()));
chatSettingsMenu->addSeparator();
aOpenChatSettings = chatSettingsMenu->addAction(QString());
connect(aOpenChatSettings, SIGNAL(triggered()), this, SLOT(actOpenChatSettings()));
QToolButton *chatSettingsButton = new QToolButton;
chatSettingsButton->setIcon(QPixmap("theme:icons/settings"));
chatSettingsButton->setMenu(chatSettingsMenu);
chatSettingsButton->setPopupMode(QToolButton::InstantPopup);
QHBoxLayout *sayHbox = new QHBoxLayout;
sayHbox->addWidget(sayLabel);
sayHbox->addWidget(sayEdit);
sayHbox->addWidget(chatSettingsButton);
QVBoxLayout *chatVbox = new QVBoxLayout;
chatVbox->addWidget(chatView);
chatVbox->addLayout(sayHbox);
chatGroupBox = new QGroupBox;
chatGroupBox->setLayout(chatVbox);
QSplitter *splitter = new QSplitter(Qt::Vertical);
splitter->addWidget(gameSelector);
splitter->addWidget(chatGroupBox);
QHBoxLayout *hbox = new QHBoxLayout;
hbox->addWidget(splitter, 3);
hbox->addWidget(userList, 1);
aLeaveRoom = new QAction(this);
connect(aLeaveRoom, SIGNAL(triggered()), this, SLOT(actLeaveRoom()));
roomMenu = new QMenu(this);
roomMenu->addAction(aLeaveRoom);
addTabMenu(roomMenu);
const int userListSize = info.user_list_size();
for (int i = 0; i < userListSize; ++i){
userList->processUserInfo(info.user_list(i), true);
autocompleteUserList.append("@" + QString::fromStdString(info.user_list(i).name()));
}
userList->sortItems();
const int gameListSize = info.game_list_size();
for (int i = 0; i < gameListSize; ++i)
gameSelector->processGameInfo(info.game_list(i));
completer = new QCompleter(autocompleteUserList, sayEdit);
completer->setCaseSensitivity(Qt::CaseInsensitive);
completer->setMaxVisibleItems(5);
#if QT_VERSION >= 0x050000
completer->setFilterMode(Qt::MatchStartsWith);
#endif
sayEdit->setCompleter(completer);
actCompleterChanged();
connect(&settingsCache->shortcuts(), SIGNAL(shortCutchanged()),this,SLOT(refreshShortcuts()));
refreshShortcuts();
retranslateUi();
QWidget * mainWidget = new QWidget(this);
mainWidget->setLayout(hbox);
setCentralWidget(mainWidget);
}
示例14: QFrame
/**********************************************************************
* Speed control widget
**********************************************************************/
SpeedControlWidget::SpeedControlWidget( intf_thread_t *_p_i, QWidget *_parent )
: QFrame( _parent ), p_intf( _p_i )
{
QSizePolicy sizePolicy( QSizePolicy::Fixed, QSizePolicy::Maximum );
sizePolicy.setHorizontalStretch( 0 );
sizePolicy.setVerticalStretch( 0 );
speedSlider = new QSlider( this );
speedSlider->setSizePolicy( sizePolicy );
speedSlider->setMinimumSize( QSize( 140, 20 ) );
speedSlider->setOrientation( Qt::Horizontal );
speedSlider->setTickPosition( QSlider::TicksBelow );
speedSlider->setRange( -34, 34 );
speedSlider->setSingleStep( 1 );
speedSlider->setPageStep( 1 );
speedSlider->setTickInterval( 17 );
CONNECT( speedSlider, valueChanged( int ), this, updateRate( int ) );
QToolButton *normalSpeedButton = new QToolButton( this );
normalSpeedButton->setMaximumSize( QSize( 26, 16 ) );
normalSpeedButton->setAutoRaise( true );
normalSpeedButton->setText( "1x" );
normalSpeedButton->setToolTip( qtr( "Revert to normal play speed" ) );
CONNECT( normalSpeedButton, clicked(), this, resetRate() );
QToolButton *slowerButton = new QToolButton( this );
slowerButton->setMaximumSize( QSize( 26, 16 ) );
slowerButton->setAutoRaise( true );
slowerButton->setToolTip( tooltipL[SLOWER_BUTTON] );
slowerButton->setIcon( QIcon( iconL[SLOWER_BUTTON] ) );
CONNECT( slowerButton, clicked(), THEMIM->getIM(), slower() );
QToolButton *fasterButton = new QToolButton( this );
fasterButton->setMaximumSize( QSize( 26, 16 ) );
fasterButton->setAutoRaise( true );
fasterButton->setToolTip( tooltipL[FASTER_BUTTON] );
fasterButton->setIcon( QIcon( iconL[FASTER_BUTTON] ) );
CONNECT( fasterButton, clicked(), THEMIM->getIM(), faster() );
/* spinBox = new QDoubleSpinBox();
spinBox->setDecimals( 2 );
spinBox->setMaximum( 32 );
spinBox->setMinimum( 0.03F );
spinBox->setSingleStep( 0.10F );
spinBox->setAlignment( Qt::AlignRight );
CONNECT( spinBox, valueChanged( double ), this, updateSpinBoxRate( double ) ); */
QGridLayout* speedControlLayout = new QGridLayout( this );
speedControlLayout->addWidget( speedSlider, 0, 0, 1, 3 );
speedControlLayout->addWidget( slowerButton, 1, 0 );
speedControlLayout->addWidget( normalSpeedButton, 1, 1, 1, 1, Qt::AlignRight );
speedControlLayout->addWidget( fasterButton, 1, 2, 1, 1, Qt::AlignRight );
//speedControlLayout->addWidget( spinBox );
speedControlLayout->setContentsMargins( 0, 0, 0, 0 );
speedControlLayout->setSpacing( 0 );
lastValue = 0;
activateOnState();
}
示例15: QWidget
/**
* Constructor.
*/
QG_LayerWidget::QG_LayerWidget(QG_ActionHandler* ah, QWidget* parent,
const char* name, Qt::WindowFlags f)
: QWidget(parent, f) {
setObjectName(name);
actionHandler = ah;
layerList = nullptr;
showByBlock = false;
lastLayer = nullptr;
layerModel = new QG_LayerModel(this);
layerView = new QTableView(this);
layerView->setModel (layerModel);
layerView->setShowGrid (false);
layerView->setSelectionMode(QAbstractItemView::SingleSelection);
layerView->setEditTriggers(QAbstractItemView::NoEditTriggers);
layerView->setFocusPolicy(Qt::NoFocus);
layerView->setMinimumHeight(140);
layerView->setColumnWidth(QG_LayerModel::VISIBLE, 18);
layerView->setColumnWidth(QG_LayerModel::LOCKED, 18);
layerView->setColumnWidth(QG_LayerModel::PRINT, 24);
layerView->setColumnWidth(QG_LayerModel::CONSTRUCTION, 18);
layerView->verticalHeader()->hide();
layerView->horizontalHeader()->setStretchLastSection(true);
layerView->horizontalHeader()->hide();
QVBoxLayout* lay = new QVBoxLayout(this);
lay->setSpacing ( 0 );
lay->setContentsMargins(2, 2, 2, 2);
QHBoxLayout* layButtons = new QHBoxLayout;
QToolButton* but;
const QSize minButSize(22,22);
// show all layer:
but = new QToolButton(this);
but->setIcon(QIcon(":ui/visiblelayer.png"));
but->setMinimumSize(minButSize);
but->setToolTip(tr("Show all layers"));
connect(but, SIGNAL(clicked()),
actionHandler, SLOT(slotLayersDefreezeAll()));
layButtons->addWidget(but);
// hide all layer:
but = new QToolButton(this);
but->setIcon(QIcon(":ui/hiddenlayer.png"));
but->setMinimumSize(minButSize);
but->setToolTip(tr("Hide all layers"));
connect(but, SIGNAL(clicked()),
actionHandler, SLOT(slotLayersFreezeAll()));
layButtons->addWidget(but);
// add layer:
but = new QToolButton(this);
but->setIcon(QIcon(":ui/layeradd.png"));
but->setMinimumSize(minButSize);
but->setToolTip(tr("Add a layer"));
connect(but, SIGNAL(clicked()),
actionHandler, SLOT(slotLayersAdd()));
layButtons->addWidget(but);
// remove layer:
but = new QToolButton(this);
but->setIcon(QIcon(":ui/layerremove.png"));
but->setMinimumSize(minButSize);
but->setToolTip(tr("Remove the current layer"));
connect(but, SIGNAL(clicked()),
actionHandler, SLOT(slotLayersRemove()));
layButtons->addWidget(but);
// rename layer:
but = new QToolButton(this);
but->setIcon(QIcon(":ui/layeredit.png"));
but->setMinimumSize(minButSize);
but->setToolTip(tr("Modify layer attributes / rename"));
connect(but, SIGNAL(clicked()),
actionHandler, SLOT(slotLayersEdit()));
layButtons->addWidget(but);
// lineEdit to filter layer list with RegEx
matchLayerName = new QLineEdit(this);
matchLayerName->setReadOnly(false);
//matchLayerName->setText("*");
matchLayerName->setToolTip(tr("Looking for matching layer names"));
connect(matchLayerName, SIGNAL( textChanged(QString) ), this, SLOT( slotUpdateLayerList() ) );
//lay->addWidget(caption);
lay->addWidget(matchLayerName);
lay->addLayout(layButtons);
lay->addWidget(layerView);
this->setLayout(lay);
connect(layerView, SIGNAL(pressed(QModelIndex)), this, SLOT(slotActivated(QModelIndex)));
}