本文整理汇总了C++中QToolButton::setArrowType方法的典型用法代码示例。如果您正苦于以下问题:C++ QToolButton::setArrowType方法的具体用法?C++ QToolButton::setArrowType怎么用?C++ QToolButton::setArrowType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QToolButton
的用法示例。
在下文中一共展示了QToolButton::setArrowType方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: d
// ------------------
// HintProposalWidget
// ------------------
FunctionHintProposalWidget::FunctionHintProposalWidget()
: d(new FunctionHintProposalWidgetPrivate)
{
QToolButton *downArrow = new QToolButton;
downArrow->setArrowType(Qt::DownArrow);
downArrow->setFixedSize(16, 16);
downArrow->setAutoRaise(true);
QToolButton *upArrow = new QToolButton;
upArrow->setArrowType(Qt::UpArrow);
upArrow->setFixedSize(16, 16);
upArrow->setAutoRaise(true);
QHBoxLayout *pagerLayout = new QHBoxLayout(d->m_pager);
pagerLayout->setMargin(0);
pagerLayout->setSpacing(0);
pagerLayout->addWidget(upArrow);
pagerLayout->addWidget(d->m_numberLabel);
pagerLayout->addWidget(downArrow);
QHBoxLayout *popupLayout = new QHBoxLayout(d->m_popupFrame);
popupLayout->setMargin(0);
popupLayout->setSpacing(0);
popupLayout->addWidget(d->m_pager);
popupLayout->addWidget(d->m_hintLabel);
connect(upArrow, SIGNAL(clicked()), SLOT(previousPage()));
connect(downArrow, SIGNAL(clicked()), SLOT(nextPage()));
qApp->installEventFilter(this);
setFocusPolicy(Qt::NoFocus);
}
示例2: setOpen
void Task::setOpen(bool o) {
QToolButton *b = m_header->toggleButton();
if (b->isChecked() == o) {
b->setChecked(o);
if (b->arrowType()!=Qt::NoArrow) {
if (o) {
b->setArrowType(Qt::UpArrow);
} else {
b->setArrowType(Qt::DownArrow);
}
}
QwwTaskPanel *tp = parent() ? qobject_cast<QwwTaskPanel*>(parent()->parent()->parent()->parent()) : 0;
if(tp && tp->isAnimated()){
if (m_animator.state()!=QTimeLine::NotRunning) {
m_animator.setDirection(m_animator.direction()==QTimeLine::Forward ? QTimeLine::Backward : QTimeLine::Forward);
} else {
m_animBody = new QWidget;
m_animBody->installEventFilter(this);
#ifndef Q_WS_WIN
m_animBody->setEnabled(false);
#endif
m_animBody->setAttribute(Qt::WA_NoSystemBackground, true);
body()->ensurePolished();
QSize s = QLayout::closestAcceptableSize(body(), body()->sizeHint()).expandedTo(QSize(width(), 0));
body()->resize(s);
body()->setAttribute(Qt::WA_WState_ExplicitShowHide, true);
body()->setAttribute(Qt::WA_WState_Hidden, false);
m_animpix = QPixmap::grabWidget(body());
body()->setAttribute(Qt::WA_WState_Hidden, true);
if (o) {
m_animator.setDirection(QTimeLine::Forward);
m_animator.setFrameRange(0, s.height());
} else {
m_animator.setDirection(QTimeLine::Backward);
m_animator.setFrameRange(0, m_body->height());
}
m_body->hide();
QVBoxLayout *l = (QVBoxLayout*)layout();
l->addWidget(m_animBody);
m_animBody->show();
m_animator.start();
}
} else {
if(o)
m_body->show();
else
m_body->hide();
}
}
}
示例3: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
// create TabListMenu
QSint::TabListMenu *tabMenu = new QSint::TabListMenu(this);
// assing ui->tabWidget to the tabMenu
tabMenu->setTabs(ui->tabWidget);
// create corner button
QToolButton *tbTabsDropList = new QToolButton(this);
tbTabsDropList->setArrowType(Qt::DownArrow);
tbTabsDropList->setPopupMode(QToolButton::InstantPopup);
ui->tabWidget->setCornerWidget(tbTabsDropList);
// assing tabMenu to the tbTabsDropList
tbTabsDropList->setMenu(tabMenu);
// just for demo: connect cbUseIcons checkbox to the tabMenu's setAllowIcons() slot
connect(ui->cbUseIcons, SIGNAL(toggled(bool)), tabMenu, SLOT(setAllowIcons(bool)));
}
示例4: build
void BookmarksToolBar::build()
{
clear();
for (int i = 0; i < m_bookmarksModel->rowCount(m_root); ++i) {
QModelIndex idx = m_bookmarksModel->index(i, 0, m_root);
if (m_bookmarksModel->hasChildren(idx)) {
QToolButton *button = new QToolButton(this);
button->setPopupMode(QToolButton::InstantPopup);
button->setArrowType(Qt::DownArrow);
button->setText(idx.data().toString());
ModelMenu *menu = new ModelMenu(this);
connect(menu, SIGNAL(activated(QModelIndex)),
this, SLOT(activated(QModelIndex)));
menu->setModel(m_bookmarksModel);
menu->setRootIndex(idx);
menu->addAction(new QAction(menu));
button->setMenu(menu);
button->setToolButtonStyle(Qt::ToolButtonTextOnly);
QAction *a = addWidget(button);
a->setText(idx.data().toString());
} else {
QAction *action = addAction(idx.data().toString());
action->setData(idx.data(BookmarksModel::UrlRole));
}
}
}
示例5: QToolButton
QT_BEGIN_NAMESPACE
static QToolButton *createToolButton(QWidget *parent, Qt::ArrowType at, const QString &name) {
QToolButton *rc = new QToolButton();
rc->setAttribute(Qt::WA_NoChildEventsForParent, true);
rc->setParent(parent);
rc->setObjectName(name);
rc->setArrowType(at);
rc->setAutoRaise(true);
rc->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
rc->setFixedSize(QSize(15, 15));
return rc;
}
示例6: build
void BookmarksToolBar::build()
{
clear();
for (int i = 0; i < m_bookmarksModel->rowCount(m_root); ++i) {
QModelIndex idx = m_bookmarksModel->index(i, 0, m_root);
QVariant variant;
variant.setValue(idx);
QString title = idx.data().toString();
bool folder = m_bookmarksModel->hasChildren(idx);
QToolButton *button = 0;
if (folder)
button = new QToolButton(this);
else
button = new BookmarkToolButton(this);
button->setPopupMode(QToolButton::InstantPopup);
button->setToolButtonStyle(Qt::ToolButtonTextOnly);
QAction *action = addWidget(button);
action->setData(variant);
action->setText(title);
button->setDefaultAction(action);
if (folder) {
button->setArrowType(Qt::DownArrow);
ModelMenu *menu = new BookmarksMenu(this);
menu->setModel(m_bookmarksModel);
menu->setRootIndex(idx);
menu->addAction(new QAction(menu));
action->setMenu(menu);
connect(menu, SIGNAL(openUrl(const QUrl &, const QString &)),
this, SIGNAL(openUrl(const QUrl &, const QString &)));
connect(menu, SIGNAL(openUrl(const QUrl &, TabWidget::OpenUrlIn, const QString &)),
this, SIGNAL(openUrl(const QUrl &, TabWidget::OpenUrlIn, const QString &)));
} else {
connect(action, SIGNAL(triggered()),
this, SLOT(openBookmark()));
}
}
示例7: QGridLayout
MainWindow::MainWindow()
{
ui.setupUi(this);
this->setWindowTitle(tr("Texture Atlas Maker v0.96 (18-08-2011)"));
readSettings();
///////////////////////////////////////////////
QGridLayout *gridLayout_2 = new QGridLayout(ui.page_textures);
TextureListWidget *listViewTextures = new TextureListWidget(ui.page_textures);
listViewTextures->setObjectName(QString::fromUtf8("listViewTextures"));
QSizePolicy sizePolicy2(QSizePolicy::Minimum, QSizePolicy::Expanding);
sizePolicy2.setHorizontalStretch(0);
sizePolicy2.setVerticalStretch(0);
sizePolicy2.setHeightForWidth(listViewTextures->sizePolicy().hasHeightForWidth());
listViewTextures->setSizePolicy(sizePolicy2);
gridLayout_2->addWidget(listViewTextures, 0, 0, 1, 4);
QToolButton *toolButtonAddFile = new QToolButton(ui.page_textures);
toolButtonAddFile->setText(tr("add file"));
toolButtonAddFile->setObjectName(QString::fromUtf8("toolButtonAddFile"));
gridLayout_2->addWidget(toolButtonAddFile, 1, 0, 1, 2);
QToolButton *toolButtonAddFolder = new QToolButton(ui.page_textures);
toolButtonAddFolder->setText(tr("add folder"));
toolButtonAddFolder->setObjectName(QString::fromUtf8("toolButtonAddFolder"));
gridLayout_2->addWidget(toolButtonAddFolder, 2, 0, 1, 2);
QToolButton *toolExport = new QToolButton(ui.page_textures);
toolExport->setText(tr("export"));
toolExport->setToolTip(tr("Export selected images"));
gridLayout_2->addWidget(toolExport, 1, 2, 1, 2);
QToolButton *toolButtonClear = new QToolButton(ui.page_textures);
toolButtonClear->setText(tr("clear"));
toolButtonClear->setObjectName(QString::fromUtf8("toolButtonClear"));
gridLayout_2->addWidget(toolButtonClear, 2, 2, 1, 2);
comboBoxResolution = new QComboBox(ui.page_textures);
comboBoxResolution->setObjectName(QString::fromUtf8("comboBoxResolution"));
gridLayout_2->addWidget(comboBoxResolution, 3, 0, 1, 2);
QToolButton *toolButtonAddResolution = new QToolButton(ui.page_textures);
toolButtonAddResolution->setText(tr("+"));
toolButtonAddResolution->setObjectName(QString::fromUtf8("toolButtonAddResolution"));
toolButtonAddResolution->setArrowType(Qt::NoArrow);
gridLayout_2->addWidget(toolButtonAddResolution, 3, 2, 1, 1);
////////////////////////////////////////
/////////////////
comboBoxResolution->addItem("2048*2048", 2048);
comboBoxResolution->addItem("1024*1024", 1024);
comboBoxResolution->addItem("512*512", 512);
comboBoxResolution->addItem("256*256", 256);
comboBoxResolution->addItem("128*128", 128);
textureModel = new TextureModel(this);
listViewTextures->setModel(textureModel);
ui.workArea->setAcceptDrops(true);
ui.workArea->setTextureModel(textureModel);
ui.workArea->setUpdatesEnabled(true);
ui.workArea->update();
connect(toolButtonAddFile,SIGNAL(clicked(bool)), this,SLOT(AddFile()));
connect(toolButtonAddFolder,SIGNAL(clicked(bool)), this,SLOT(AddFolder()));
connect(toolButtonClear,SIGNAL(clicked(bool)), textureModel,SLOT(clear()));
connect(toolExport,SIGNAL(clicked(bool)), listViewTextures,SLOT(saveSelectedImages()));
connect(comboBoxResolution,SIGNAL(currentIndexChanged(int)), this,SLOT(resolutionAtlasChange()));
connect(toolButtonAddResolution,SIGNAL(clicked(bool)), this,SLOT(AddNewResolution()));
QAction *bindingAction = ui.toolBar->addAction(tr("binding"));
bindingAction->setCheckable(true);
bindingAction->setChecked(false);
connect(bindingAction, SIGNAL(triggered(bool)), ui.workArea,SLOT(setBinding(bool)));
QAction *remakeAction = ui.toolBar->addAction(tr("remake"));
connect(remakeAction,SIGNAL(triggered(bool)), textureModel,SLOT(arrangeImages()));
//.........这里部分代码省略.........
示例8: PFSViewException
PFSViewMainWin::PFSViewMainWin( float window_min, float window_max ):
QMainWindow( 0 )
{
currentFrame = frameList.end();
QScrollArea *pfsViewArea = new PFSViewWidgetArea( this );
pfsView = (PFSViewWidget*)pfsViewArea->widget();
setCentralWidget( pfsViewArea );
setWindowIcon( QIcon( ":icons/appicon.png" ) );
QAction *nextFrameAct = new QAction( tr( "&Next frame" ), this );
nextFrameAct->setStatusTip( tr( "Load next frame" ) );
nextFrameAct->setShortcut( Qt::Key_PageDown );
connect( nextFrameAct, SIGNAL(triggered()), this, SLOT(gotoNextFrame()) );
QAction *previousFrameAct = new QAction( tr( "&Previous frame" ), this );
previousFrameAct->setStatusTip( tr( "Load previous frame" ) );
previousFrameAct->setShortcut( Qt::Key_PageUp );
connect( previousFrameAct, SIGNAL(triggered()), this, SLOT(gotoPreviousFrame()) );
QToolBar *toolBar = addToolBar( tr( "Navigation" ) );
// toolBar->setHorizontalStretchable( true );
QToolButton *previousFrameBt = new QToolButton( toolBar );
previousFrameBt->setArrowType( Qt::LeftArrow );
previousFrameBt->setMinimumWidth( 15 );
connect( previousFrameBt, SIGNAL(clicked()), this, SLOT(gotoPreviousFrame()) );
previousFrameBt->setToolTip( "Goto previous frame" );
toolBar->addWidget( previousFrameBt );
QToolButton *nextFrameBt = new QToolButton( toolBar );
nextFrameBt->setArrowType( Qt::RightArrow );
nextFrameBt->setMinimumWidth( 15 );
connect( nextFrameBt, SIGNAL(clicked()), this, SLOT(gotoNextFrame()) );
nextFrameBt->setToolTip( "Goto next frame" );
toolBar->addWidget( nextFrameBt );
QLabel *channelSelLabel = new QLabel( "&Channel", toolBar );
channelSelection = new QComboBox( toolBar );
channelSelLabel->setBuddy( channelSelection );
connect( channelSelection, SIGNAL( activated( int ) ),
this, SLOT( setChannelSelection(int) ) );
toolBar->addWidget( channelSelLabel );
toolBar->addWidget( channelSelection );
toolBar->addSeparator();
QLabel *mappingMethodLabel = new QLabel( "&Mapping", toolBar );
mappingMethodLabel->setAlignment( Qt::AlignRight | Qt::AlignVCenter ); // |
// Qt::TextExpandTabs | Qt::TextShowMnemonic );
mappingMethodCB = new QComboBox( toolBar );
mappingMethodLabel->setBuddy( mappingMethodCB );
mappingMethodCB->addItem( "Linear" );
mappingMethodCB->addItem( "Gamma 1.4" );
mappingMethodCB->addItem( "Gamma 1.8" );
mappingMethodCB->addItem( "Gamma 2.2" );
mappingMethodCB->addItem( "Gamma 2.6" );
mappingMethodCB->addItem( "Logarithmic" );
mappingMethodCB->setCurrentIndex( 3 );
connect( mappingMethodCB, SIGNAL( activated( int ) ),
this, SLOT( setLumMappingMethod(int) ) );
toolBar->addWidget( mappingMethodLabel );
toolBar->addWidget( mappingMethodCB );
// addToolBar( Qt::BottomToolBarArea, toolBar );
QToolBar *toolBarLR = addToolBar( tr( "Histogram" ) );
lumRange = new LuminanceRangeWidget( toolBarLR );
connect( lumRange, SIGNAL( updateRangeWindow() ), this,
SLOT( updateRangeWindow() ) );
toolBarLR->addWidget( lumRange );
// addToolBar( toolBar );
pointerPosAndVal = new QLabel( statusBar() );
statusBar()->addWidget( pointerPosAndVal );
// QFont fixedFont = QFont::defaultFont();
// fixedFont.setFixedPitch( true );
// pointerPosAndVal->setFont( fixedFont );
zoomValue = new QLabel( statusBar() );
statusBar()->addWidget( zoomValue );
exposureValue = new QLabel( statusBar() );
statusBar()->addWidget( exposureValue );
connect( pfsView, SIGNAL(updatePointerValue()),
this, SLOT(updatePointerValue()) );
QMenu *frameMenu = menuBar()->addMenu( tr( "&Frame" ) );
frameMenu->addAction( nextFrameAct );
frameMenu->addAction( previousFrameAct );
frameMenu->addSeparator();
frameMenu->addAction( "&Save image...", this, SLOT(saveImage()), QKeySequence::Save );
frameMenu->addAction( "&Copy image to clipboard", this, SLOT(copyImage()), QKeySequence::Copy );
frameMenu->addSeparator();
frameMenu->addAction( "&Quit", qApp, SLOT(quit()), Qt::Key_Q ); //QKeySequence::Quit
//.........这里部分代码省略.........
示例9: setupGUI
//------------------------------------------------------------------------------------------
void Controller::setupGUI()
{
////////////////////////////////////////////////////////////////////////////////
// environment textures
QGridLayout* envTextureLayout = new QGridLayout;
cbEnvTexture = new QComboBox;
envTextureLayout->addWidget(cbEnvTexture, 0, 0, 1, 3);
cbEnvTexture->addItem("None");
cbEnvTexture->addItem("Sky1");
cbEnvTexture->addItem("Sky2");
cbEnvTexture->addItem("Sky3");
QToolButton* btnPreviousEnvTexture = new QToolButton;
btnPreviousEnvTexture->setArrowType(Qt::LeftArrow);
envTextureLayout->addWidget(btnPreviousEnvTexture, 0, 3, 1, 1);
QToolButton* btnNextEnvTexture = new QToolButton;
btnNextEnvTexture->setArrowType(Qt::RightArrow);
envTextureLayout->addWidget(btnNextEnvTexture, 0, 4, 1, 1);
connect(btnPreviousEnvTexture, SIGNAL(clicked()), this, SLOT(prevEnvTexture()));
connect(btnNextEnvTexture, SIGNAL(clicked()), this, SLOT(nextEnvTexture()));
QGroupBox* envTextureGroup = new QGroupBox("Background");
envTextureGroup->setLayout(envTextureLayout);
////////////////////////////////////////////////////////////////////////////////
// floor textures
QGridLayout* floorTextureLayout = new QGridLayout;
cbFloorTexture = new QComboBox;
floorTextureLayout->addWidget(cbFloorTexture, 0, 0, 1, 3);
cbFloorTexture->addItem("None");
cbFloorTexture->addItem("Checkerboard 1");
cbFloorTexture->addItem("Checkerboard 2");
cbFloorTexture->addItem("Stone 1");
cbFloorTexture->addItem("Stone 2");
cbFloorTexture->addItem("Wood 1");
cbFloorTexture->addItem("Wood 2");
QToolButton* btnPreviousFloorTexture = new QToolButton;
btnPreviousFloorTexture->setArrowType(Qt::LeftArrow);
floorTextureLayout->addWidget(btnPreviousFloorTexture, 0, 3, 1, 1);
QToolButton* btnNextFloorTexture = new QToolButton;
btnNextFloorTexture->setArrowType(Qt::RightArrow);
floorTextureLayout->addWidget(btnNextFloorTexture, 0, 4, 1, 1);
connect(btnPreviousFloorTexture, SIGNAL(clicked()), this, SLOT(prevFloorTexture()));
connect(btnNextFloorTexture, SIGNAL(clicked()), this, SLOT(nextFloorTexture()));
// cbFloorTexture->setCurrentIndex(1);
QGroupBox* floorTextureGroup = new QGroupBox("Floor");
floorTextureGroup->setLayout(floorTextureLayout);
////////////////////////////////////////////////////////////////////////////////
// frame time
sldFrameTime = new QSlider(Qt::Horizontal);
sldFrameTime ->setRange(1, 100);
sldFrameTime ->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
QSpinBox* spFrameTime = new QSpinBox;
spFrameTime->setRange(1, 100);
connect(sldFrameTime, &QSlider::valueChanged, spFrameTime, &QSpinBox::setValue);
connect(spFrameTime, SIGNAL(valueChanged(int)), sldFrameTime, SLOT(setValue(int)));
QGridLayout* frameTimeLayout = new QGridLayout;
frameTimeLayout->addWidget(sldFrameTime, 0, 0, 1, 5);
frameTimeLayout->addWidget(spFrameTime, 0, 5, 1, 1);
QGroupBox* frameTimeGroup = new QGroupBox("Frame Sleep(ms)");
frameTimeGroup->setLayout(frameTimeLayout);
///////////////////////////////////////////////////////////////////////////////
// frame stride
sldFrameStride = new QSlider(Qt::Horizontal);
sldFrameStride ->setRange(1, 100);
sldFrameStride ->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
QSpinBox* spFrameStride = new QSpinBox;
spFrameStride->setRange(1, 100);
connect(sldFrameStride, &QSlider::valueChanged, spFrameStride, &QSpinBox::setValue);
connect(spFrameStride, SIGNAL(valueChanged(int)), sldFrameStride, SLOT(setValue(int)));
QGridLayout* frameStrideLayout = new QGridLayout;
frameStrideLayout->addWidget(sldFrameStride, 0, 0, 1, 5);
frameStrideLayout->addWidget(spFrameStride, 0, 5, 1, 1);
QGroupBox* frameStrideGroup = new QGroupBox("Frame Stride");
frameStrideGroup->setLayout(frameStrideLayout);
////////////////////////////////////////////////////////////////////////////////
/// color modes
//.........这里部分代码省略.........
示例10: metrics
IncrementalSearchBar::IncrementalSearchBar(QWidget* parent)
: QWidget(parent)
, _foundMatch(false)
, _searchEdit(0)
,_caseSensitive(0)
,_regExpression(0)
,_highlightMatches(0)
{
QHBoxLayout* layout = new QHBoxLayout(this);
QToolButton* close = new QToolButton(this);
close->setObjectName( QLatin1String("close-button" ));
close->setToolTip( i18n("Close the search bar") );
close->setAutoRaise(true);
close->setIcon(KIcon("dialog-close"));
connect( close , SIGNAL(clicked()) , this , SIGNAL(closeClicked()) );
QLabel* findLabel = new QLabel(i18n("Find:"),this);
_searchEdit = new KLineEdit(this);
_searchEdit->setClearButtonShown(true);
_searchEdit->installEventFilter(this);
_searchEdit->setObjectName( QLatin1String("search-edit" ));
_searchEdit->setToolTip( i18n("Enter the text to search for here") );
// text box may be a minimum of 6 characters wide and a maximum of 10 characters wide
// (since the maxWidth metric is used here, more characters probably will fit in than 6
// and 10)
QFontMetrics metrics(_searchEdit->font());
int maxWidth = metrics.maxWidth();
_searchEdit->setMinimumWidth(maxWidth*6);
_searchEdit->setMaximumWidth(maxWidth*10);
_searchTimer = new QTimer(this);
_searchTimer->setInterval(250);
_searchTimer->setSingleShot(true);
connect( _searchTimer , SIGNAL(timeout()) , this , SLOT(notifySearchChanged()) );
connect( _searchEdit , SIGNAL(clearButtonClicked()) , this , SLOT(clearLineEdit()) );
connect( _searchEdit , SIGNAL(textChanged(QString)) , _searchTimer , SLOT(start()));
QToolButton* findNext = new QToolButton(this);
findNext->setObjectName( QLatin1String("find-next-button" ));
findNext->setText(i18nc("@action:button Go to the next phrase", "Next"));
findNext->setIcon( KIcon("go-down-search") );
findNext->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
findNext->setToolTip( i18n("Find the next match for the current search phrase") );
connect( findNext , SIGNAL(clicked()) , this , SIGNAL(findNextClicked()) );
QToolButton* findPrev = new QToolButton(this);
findPrev->setObjectName( QLatin1String("find-previous-button" ));
findPrev->setText(i18nc("@action:button Go to the previous phrase", "Previous"));
findPrev->setIcon( KIcon("go-up-search") );
findPrev->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
findPrev->setToolTip( i18n("Find the previous match for the current search phrase") );
connect( findPrev , SIGNAL(clicked()) , this , SIGNAL(findPreviousClicked()) );
QToolButton* optionsButton = new QToolButton(this);
optionsButton->setObjectName( QLatin1String("find-options-button" ));
optionsButton->setText(i18nc("@action:button Display options menu", "Options"));
optionsButton->setCheckable(false);
optionsButton->setPopupMode(QToolButton::InstantPopup);
optionsButton->setArrowType(Qt::DownArrow);
optionsButton->setToolButtonStyle(Qt::ToolButtonTextOnly);
optionsButton->setToolTip( i18n("Display the options menu") );
layout->addWidget(close);
layout->addWidget(findLabel);
layout->addWidget(_searchEdit);
layout->addWidget(findNext);
layout->addWidget(findPrev);
layout->addWidget(optionsButton);
// Fill the options menu
QMenu* optionsMenu = new QMenu(this);
optionsButton->setMenu(optionsMenu);
_caseSensitive = optionsMenu->addAction(i18n("Case sensitive"));
_caseSensitive->setCheckable(true);
_caseSensitive->setToolTip(i18n("Sets whether the search is case sensitive"));
connect(_caseSensitive, SIGNAL(toggled(bool)),
this, SIGNAL(matchCaseToggled(bool)) );
_regExpression = optionsMenu->addAction(i18n("Match regular expression"));
_regExpression->setCheckable(true);
connect(_regExpression, SIGNAL(toggled(bool)),
this, SIGNAL(matchRegExpToggled(bool)));
_highlightMatches = optionsMenu->addAction(i18n("Highlight all matches"));
_highlightMatches->setCheckable(true);
_highlightMatches->setToolTip(i18n("Sets whether matching text should be highlighted"));
_highlightMatches->setChecked(true);
connect(_highlightMatches, SIGNAL(toggled(bool)),
this, SIGNAL(highlightMatchesToggled(bool)) );
layout->addStretch();
layout->setContentsMargins(4, 4, 4, 4);
setLayout(layout);
}
示例11: QWidget
GlobStore::GlobStore(QWidget *parent)
: QWidget(parent)
{
int l1;
midiControl = new MidiControl(this);
midiControl->ID = -2;
midiControl->parentDockID = -2;
activeStore = 0;
currentRequest = 0;
switchAtBeat = 0;
storeSignalMapper = new QSignalMapper(this);
connect(storeSignalMapper, SIGNAL(mapped(int)),
this, SLOT(storeAll(int)));
timeModeBox = new QComboBox;
timeModeBox->addItem(tr("End of"));
timeModeBox->addItem(tr("After"));
connect(timeModeBox, SIGNAL(activated(int)),
this, SLOT(updateTimeModeBox(int)));
switchAtBeatBox = new QComboBox;
for (l1 = 0; l1 < 16; l1++) {
switchAtBeatBox->addItem(QString::number(l1 + 1)+" beats");
}
switchAtBeatBox->hide();
connect(switchAtBeatBox, SIGNAL(activated(int)),
this, SLOT(updateSwitchAtBeat(int)));
timeModuleBox = new QComboBox;
timeModuleBox->setCurrentIndex(0);
connect(timeModuleBox, SIGNAL(activated(int)),
this, SLOT(updateTimeModule(int)));
QWidget *indicatorBox = new QWidget;
QHBoxLayout *indicatorLayout = new QHBoxLayout;
indicator = new Indicator(20, ' ');
indicatorBox->setMinimumHeight(30);
indicatorBox->setMinimumWidth(30);
indicatorLayout->addWidget(indicator);
indicatorLayout->setMargin(2);
indicatorLayout->setSpacing(1);
indicatorBox->setLayout(indicatorLayout);
QHBoxLayout *timeModeLayout = new QHBoxLayout;
timeModeLayout->addWidget(timeModeBox);
timeModeLayout->addWidget(timeModuleBox);
timeModeLayout->addWidget(switchAtBeatBox);
timeModeLayout->addWidget(indicatorBox);
timeModeLayout->setSpacing(0);
timeModeLayout->addStretch();
QHBoxLayout *upperRowLayout = new QHBoxLayout;
upperRowLayout->addLayout(timeModeLayout);
upperRowLayout->addStretch();
QAction* removeStoreAction = new QAction(tr("&Remove"), this);
QToolButton *removeStoreButton = new QToolButton;
removeStoreButton->setDefaultAction(removeStoreAction);
removeStoreButton->setFixedSize(60, 20);
removeStoreButton->setArrowType (Qt::ArrowType(1));
connect(removeStoreAction, SIGNAL(triggered()), this, SLOT(removeLocation()));
QToolButton *toolButton = new QToolButton;
toolButton->setText("Global");
toolButton->setMinimumSize(QSize(56,32));
midiControl->addMidiLearnMenu("GlobRestore", toolButton, 0);
QFrame *topRow = new QFrame;
QVBoxLayout *topRowLayout = new QVBoxLayout;
topRowLayout->addWidget(toolButton);
topRowLayout->addStretch();
topRowLayout->setSpacing(0);
topRowLayout->setMargin(0);
topRow->setFrameStyle(QFrame::StyledPanel);
topRow->setMinimumSize(QSize(48,48));;
topRow->setLayout(topRowLayout);
QVBoxLayout *buttonLayout = new QVBoxLayout;
buttonLayout->addWidget(topRow);
QVBoxLayout *columnLayout = new QVBoxLayout;
columnLayout->addLayout(buttonLayout);
columnLayout->addWidget(removeStoreButton);
columnLayout->addStretch(1);
indivButtonLayout = new QHBoxLayout;
indivButtonLayout->setSpacing(0);
indivButtonLayout->setMargin(0);
indivButtonLayout->addLayout(columnLayout);
indivButtonLayout->setSizeConstraint(QLayout::SetFixedSize);
QHBoxLayout *secondRowLayout = new QHBoxLayout;
secondRowLayout->addLayout(indivButtonLayout);
secondRowLayout->addStretch(1);
QVBoxLayout *centLayout = new QVBoxLayout;
centLayout->addLayout(upperRowLayout);
//.........这里部分代码省略.........
示例12: icon
FiGroupWidget::FiGroupWidget(FClass* parent)
: FWidget(parent, FUNC)
{
mEditing = false;
QPixmap icon(10, 10);
mGroupView = new MyTableWidget(this);
//mGroupView->setDragEnabled(false);
//mGroupView->setAcceptDrops(false);
mGroupView->setEditTriggers(QAbstractItemView::EditKeyPressed);
connect(mGroupView, SIGNAL(currentRowChanged(int))
, this, SLOT(groupRowChanged(int)));
connect(mGroupView, SIGNAL(cellDoubleClicked(int, int))
, this, SLOT(groupOpen(int, int)));
connect(mGroupView, SIGNAL(cellChanged(int, int))
, this, SLOT(groupEdited(int, int)));
connect(mGroupView, SIGNAL(dragToNirvana())
, this, SLOT(removeGroup()));
mMotherName = new QLabel(this);
//mMotherName->setWordWrap(true);
mMotherName->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
QToolButton* btn = new QToolButton(this);
btn->setAutoRaise(true);
btn->setArrowType(Qt::UpArrow);
btn->setToolTip("Up to Mother Group");
connect(btn, SIGNAL(clicked(bool)), this, SLOT(groupUp()));
QToolButton* newGroupBtn = new QToolButton(this);
newGroupBtn->setAutoRaise(true);
icon.fill(Qt::green);
newGroupBtn->setIcon(icon);
newGroupBtn->setToolTip("Add New Group");
connect(newGroupBtn, SIGNAL(clicked(bool)), this, SLOT(newGroup()));
//mMotherName->setAlignment(Qt::AlignVertical_Mask);
//mMotherName->setOrientation(Qt::Vertical);
QGridLayout* gbox = new QGridLayout;
gbox->setMargin(0);
gbox->addWidget(mMotherName, 0, 0);
gbox->addWidget(newGroupBtn, 0, 1);
gbox->addWidget(btn, 0, 2);
gbox->addWidget(mGroupView, 1, 0, 1, 3);
QWidget* gboxw = new QWidget;
gboxw->setLayout(gbox);
mMemberView = new MyTableWidget;
connect( mMemberView, SIGNAL(currentRowChanged(int))
, this, SLOT(memberRowChanged(int)));
connect( mMemberView, SIGNAL(dragInFromTableView(QTableView*))
, this, SLOT(userDragInData(QTableView*)));
connect(mMemberView, SIGNAL(dragToNirvana())
, this, SLOT(removeFromGroup()));
mSplitter = new QSplitter(Qt::Vertical);
//mSplitter->addWidget(mGroupView);
mSplitter->addWidget(gboxw);
mSplitter->addWidget(mMemberView);
mSplitter->setStretchFactor(0, 1);
mSplitter->setStretchFactor(1, 3);
QGridLayout* layout = new QGridLayout;
layout->setMargin(0);
layout->addWidget(mSplitter, 0, 0);
//layout->addWidget(, 0, 1);
setLayout(layout);
}
示例13: metrics
IncrementalSearchBar::IncrementalSearchBar(QWidget* aParent)
: QWidget(aParent)
, _searchEdit(0)
, _caseSensitive(0)
, _regExpression(0)
, _highlightMatches(0)
, _reverseSearch(0)
, _findNextButton(0)
, _findPreviousButton(0)
, _searchFromButton(0)
{
QHBoxLayout* barLayout = new QHBoxLayout(this);
QToolButton* closeButton = new QToolButton(this);
closeButton->setObjectName(QStringLiteral("close-button"));
closeButton->setToolTip(i18nc("@info:tooltip", "Close the search bar"));
closeButton->setAutoRaise(true);
closeButton->setIcon(QIcon::fromTheme(QStringLiteral("dialog-close")));
connect(closeButton , &QToolButton::clicked , this , &Konsole::IncrementalSearchBar::closeClicked);
QLabel* findLabel = new QLabel(i18nc("@label:textbox", "Find:"), this);
_searchEdit = new QLineEdit(this);
_searchEdit->setClearButtonEnabled(true);
_searchEdit->installEventFilter(this);
_searchEdit->setObjectName(QStringLiteral("search-edit"));
_searchEdit->setToolTip(i18nc("@info:tooltip", "Enter the text to search for here"));
// text box may be a minimum of 6 characters wide and a maximum of 10 characters wide
// (since the maxWidth metric is used here, more characters probably will fit in than 6
// and 10)
QFontMetrics metrics(_searchEdit->font());
int maxWidth = metrics.maxWidth();
_searchEdit->setMinimumWidth(maxWidth * 6);
_searchEdit->setMaximumWidth(maxWidth * 10);
_searchTimer = new QTimer(this);
_searchTimer->setInterval(250);
_searchTimer->setSingleShot(true);
connect(_searchTimer , &QTimer::timeout , this , &Konsole::IncrementalSearchBar::notifySearchChanged);
connect(_searchEdit , &QLineEdit::textChanged , _searchTimer , static_cast<void(QTimer::*)()>(&QTimer::start));
_findNextButton = new QToolButton(this);
_findNextButton->setObjectName(QStringLiteral("find-next-button"));
_findNextButton->setText(i18nc("@action:button Go to the next phrase", "Next"));
_findNextButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
_findNextButton->setToolTip(i18nc("@info:tooltip", "Find the next match for the current search phrase"));
connect(_findNextButton , &QToolButton::clicked , this , &Konsole::IncrementalSearchBar::findNextClicked);
_findPreviousButton = new QToolButton(this);
_findPreviousButton->setObjectName(QStringLiteral("find-previous-button"));
_findPreviousButton->setText(i18nc("@action:button Go to the previous phrase", "Previous"));
_findPreviousButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
_findPreviousButton->setToolTip(i18nc("@info:tooltip", "Find the previous match for the current search phrase"));
connect(_findPreviousButton , &QToolButton::clicked , this , &Konsole::IncrementalSearchBar::findPreviousClicked);
_searchFromButton = new QToolButton(this);
_searchFromButton->setObjectName(QStringLiteral("search-from-button"));
connect(_searchFromButton , &QToolButton::clicked , this , &Konsole::IncrementalSearchBar::searchFromClicked);
QToolButton* optionsButton = new QToolButton(this);
optionsButton->setObjectName(QStringLiteral("find-options-button"));
optionsButton->setText(i18nc("@action:button Display options menu", "Options"));
optionsButton->setCheckable(false);
optionsButton->setPopupMode(QToolButton::InstantPopup);
optionsButton->setArrowType(Qt::DownArrow);
optionsButton->setToolButtonStyle(Qt::ToolButtonTextOnly);
optionsButton->setToolTip(i18nc("@info:tooltip", "Display the options menu"));
barLayout->addWidget(closeButton);
barLayout->addWidget(findLabel);
barLayout->addWidget(_searchEdit);
barLayout->addWidget(_findNextButton);
barLayout->addWidget(_findPreviousButton);
barLayout->addWidget(_searchFromButton);
barLayout->addWidget(optionsButton);
// Fill the options menu
QMenu* optionsMenu = new QMenu(this);
optionsButton->setMenu(optionsMenu);
_caseSensitive = optionsMenu->addAction(i18nc("@item:inmenu", "Case sensitive"));
_caseSensitive->setCheckable(true);
_caseSensitive->setToolTip(i18nc("@info:tooltip", "Sets whether the search is case sensitive"));
connect(_caseSensitive, &QAction::toggled, this, &Konsole::IncrementalSearchBar::matchCaseToggled);
_regExpression = optionsMenu->addAction(i18nc("@item:inmenu", "Match regular expression"));
_regExpression->setCheckable(true);
connect(_regExpression, &QAction::toggled, this, &Konsole::IncrementalSearchBar::matchRegExpToggled);
_highlightMatches = optionsMenu->addAction(i18nc("@item:inmenu", "Highlight all matches"));
_highlightMatches->setCheckable(true);
_highlightMatches->setToolTip(i18nc("@info:tooltip", "Sets whether matching text should be highlighted"));
_highlightMatches->setChecked(true);
connect(_highlightMatches, &QAction::toggled, this, &Konsole::IncrementalSearchBar::highlightMatchesToggled);
_reverseSearch = optionsMenu->addAction(i18n("Search backwards"));
_reverseSearch->setCheckable(true);
_reverseSearch->setToolTip(i18n("Sets whether search should start from the bottom"));
_reverseSearch->setChecked(true);
//.........这里部分代码省略.........