本文整理汇总了C++中QAbstractButton::show方法的典型用法代码示例。如果您正苦于以下问题:C++ QAbstractButton::show方法的具体用法?C++ QAbstractButton::show怎么用?C++ QAbstractButton::show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAbstractButton
的用法示例。
在下文中一共展示了QAbstractButton::show方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
QAbstractButton*
FirstRunWizard::setButton( Button button, const QString& text )
{
QAbstractButton* returnButton;
switch ( button )
{
case CustomButton:
returnButton = ui->custom;
break;
case BackButton:
returnButton = ui->back;
break;
case SkipButton:
returnButton = ui->skip;
break;
case NextButton:
returnButton = ui->next;
break;
case FinishButton:
returnButton = ui->finish;
break;
}
returnButton->setText( text );
returnButton->show();
return returnButton;
}
示例2: updatePinnedTabCloseButton
void TabBar::updatePinnedTabCloseButton(int index)
{
if (!validIndex(index)) {
return;
}
WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(index));
QAbstractButton* button = qobject_cast<QAbstractButton*>(tabButton(index, closeButtonPosition()));
bool pinned = webTab && webTab->isPinned();
if (pinned) {
if (button) {
button->hide();
}
}
else {
if (button) {
button->show();
}
else {
showCloseButton(index);
}
}
}
示例3: tabChanged
void PTabWidget::tabChanged(int index) {
// Hide the close button on the old tab
if (m_lastTabIndex >= 0) {
QAbstractButton *tabButton = qobject_cast<QAbstractButton *>(tabBar()->tabButton(m_lastTabIndex, QTabBar::LeftSide));
if (!tabButton) {
tabButton = qobject_cast<QAbstractButton *>(tabBar()->tabButton(m_lastTabIndex, QTabBar::RightSide));
}
if (tabButton) {
tabButton->hide();
}
}
m_lastTabIndex = index;
// Show the close button on the new tab
if (m_lastTabIndex >= 0) {
QAbstractButton *tabButton = qobject_cast<QAbstractButton *>(tabBar()->tabButton(m_lastTabIndex, QTabBar::LeftSide));
if (!tabButton) {
tabButton = qobject_cast<QAbstractButton *>(tabBar()->tabButton(m_lastTabIndex, QTabBar::RightSide));
}
if (tabButton) {
tabButton->show();
}
}
}
示例4: addButtonsToLayout
void QDialogButtonBoxPrivate::addButtonsToLayout(const QList<QAbstractButton *> &buttonList,
bool reverse)
{
int start = reverse ? buttonList.count() - 1 : 0;
int end = reverse ? -1 : buttonList.count();
int step = reverse ? -1 : 1;
for (int i = start; i != end; i += step) {
QAbstractButton *button = buttonList.at(i);
buttonLayout->addWidget(button);
button->show();
}
}
示例5: updateCloseButton
void TabBar::updateCloseButton(int index)
{
QAbstractButton* button = qobject_cast<QAbstractButton*>(tabButton(index, QTabBar::RightSide));
if (!button) {
return;
}
WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(index));
if (webTab && webTab->isPinned()) {
button->hide();
}
else {
button->show();
}
}
示例6: layoutButtons
void QDialogButtonBoxPrivate::layoutButtons()
{
Q_Q(QDialogButtonBox);
const int MacGap = 24 - 8; // 8 is the default gap between a widget and a spacer item
for (int i = buttonLayout->count() - 1; i >= 0; --i) {
QLayoutItem *item = buttonLayout->takeAt(i);
if (QWidget *widget = item->widget())
widget->hide();
delete item;
}
int tmpPolicy = layoutPolicy;
static const int M = 5;
static int ModalRoles[M] = { AcceptRole, RejectRole, DestructiveRole, YesRole, NoRole };
if (tmpPolicy == QDialogButtonBox::MacLayout) {
bool hasModalButton = false;
for (int i = 0; i < M; ++i) {
if (!buttonLists[ModalRoles[i]].isEmpty()) {
hasModalButton = true;
break;
}
}
if (!hasModalButton)
tmpPolicy = 4; // Mac modeless
}
const int *currentLayout = layouts[orientation == Qt::Vertical][tmpPolicy];
if (center)
buttonLayout->addStretch();
QList<QAbstractButton *> acceptRoleList = buttonLists[AcceptRole];
while (*currentLayout != EOL) {
int role = (*currentLayout & ~Reverse);
bool reverse = (*currentLayout & Reverse);
switch (role) {
case Stretch:
if (!center)
buttonLayout->addStretch();
break;
case AcceptRole: {
if (acceptRoleList.isEmpty())
break;
// Only the first one
QAbstractButton *button = acceptRoleList.first();
buttonLayout->addWidget(button);
button->show();
}
break;
case AlternateRole:
{
if (acceptRoleList.size() < 2)
break;
QList<QAbstractButton *> list = acceptRoleList;
list.removeFirst();
addButtonsToLayout(list, reverse);
}
break;
case DestructiveRole:
{
const QList<QAbstractButton *> &list = buttonLists[role];
/*
Mac: Insert a gap on the left of the destructive
buttons to ensure that they don't get too close to
the help and action buttons (but only if there are
some buttons to the left of the destructive buttons
(and the stretch, whence buttonLayout->count() > 1
and not 0)).
*/
if (tmpPolicy == QDialogButtonBox::MacLayout
&& !list.isEmpty() && buttonLayout->count() > 1)
buttonLayout->addSpacing(MacGap);
addButtonsToLayout(list, reverse);
/*
Insert a gap between the destructive buttons and the
accept and reject buttons.
*/
if (tmpPolicy == QDialogButtonBox::MacLayout && !list.isEmpty())
buttonLayout->addSpacing(MacGap);
}
break;
case RejectRole:
case ActionRole:
case HelpRole:
case YesRole:
case NoRole:
case ApplyRole:
case ResetRole:
addButtonsToLayout(buttonLists[role], reverse);
}
++currentLayout;
}
//.........这里部分代码省略.........
示例7: groupChanged
void ClsQNeuronStateVariableDisplay::groupChanged(){
#ifdef DEBUG_CLSQSTATEVARIABLEDISPLAY
cout << "ClsQNeuronStateVariableDisplay::groupChanged()" << endl;
#endif
if(qLabelMiniGroup!=NULL){
QPixmap qpm;
qpm = ClsQMiniGroup::getPixmap(clsFEGroup->getTopology(), strSelectedIndices, qgrpbxStateVariables->sizeHint().width() - 10, 100);
qLabelMiniGroup->setPixmap(qpm);
}
/* change label */
string strInfo;
strInfo = "Group ID:\t" + clsFEGroup->getGroupID();
strInfo = strInfo + "\nGroup name:\t" + clsFEGroup->getGroupName();
strInfo = strInfo + "\nNeuron type:\t" + clsFEGroup->getGroupNeuronType();
strInfo = strInfo + "\nGroup width:\t" + iqrUtils::int2string(clsFEGroup->getNrCellsHorizontal());
strInfo = strInfo + "\nGroup height:\t" + iqrUtils::int2string(clsFEGroup->getNrCellsVertical());
lblCaption->setText( clsFEGroup->getGroupName().c_str());
QToolTip::add( lblCaption, strInfo.c_str() );
/* save selections */
list<string> lstSelectedState = getSelectedStates();
/* remove all buttons from the QButtonGroup */
QList<QAbstractButton *> lst = qbtngrpStateVariables->buttons ();
QList<QAbstractButton*>::iterator it;
for (it = lst.begin(); it != lst.end(); ++it) {
QAbstractButton* bb = (*it);
if(bb!=NULL){
qbtngrpStateVariables->remove(bb);
delete bb;
}
}
/* rebuild state list */
int ii=0;
StateVariableList lstNeuronStateVariables = clsFEGroup->getListNeuronStateVariables( );
iqrcommon::StateVariableList::const_iterator itlstNeuronStateVariables;
for (itlstNeuronStateVariables = lstNeuronStateVariables.begin();
itlstNeuronStateVariables != lstNeuronStateVariables.end(); ++itlstNeuronStateVariables){
QAbstractButton *qrb;
ClsStateVariable *pState = *itlstNeuronStateVariables;
if(bExclusiveStates) {
qrb = new QRadioButton ( pState->getName().c_str());
}
else{
qrb = new QCheckBox ( pState->getName().c_str());
}
qrb->show();
qbtngrpStateVariables->addButton(qrb, ii );
qlayoutStateVariables->addWidget(qrb);
ii++;
}
// qgrpbxStateVariables->setFixedHeight(qgrpbxStateVariables->sizeHint().height());
setSelectedStates(lstSelectedState);
}
示例8: ClsQBaseStateVariableDisplay
ClsQNeuronStateVariableDisplay::ClsQNeuronStateVariableDisplay(ClsFEDataClient *_clsFEDataClient,
string _strID, QWidget *_parent,
ClsFEGroup* _clsFEGroup,
string _strSelectedIndices,
bool bCloseEnabled, bool bAverageEnabled,
bool _bExclusiveStates, bool _bAdditiveDisplay, bool bMiniGroupDisplay) :
ClsQBaseStateVariableDisplay(_clsFEDataClient, _strID, _parent), clsFEGroup(_clsFEGroup),
strSelectedIndices(_strSelectedIndices), bExclusiveStates(_bExclusiveStates), bAdditiveDisplay(_bAdditiveDisplay) {
#ifdef DEBUG_CLSQSTATEVARIABLEDISPLAY
cout << "ClsQNeuronStateVariableDisplay::ClsQNeuronStateVariableDisplay(...)" << endl;
#endif
qLabelMiniGroup = NULL;
iCurrentStateButton = -99;
bAverage = false;
setAcceptDrops(TRUE);
QGridLayout *qgly = new QGridLayout ( this, 5, 1, 2, 0);
string strInfo;
strInfo = "Group ID:\t" + clsFEGroup->getGroupID();
strInfo = strInfo + "\nGroup name:\t" + clsFEGroup->getGroupName();
strInfo = strInfo + "\nNeuron type:\t" + clsFEGroup->getGroupNeuronType();
strInfo = strInfo + "\nGroup width:\t" + iqrUtils::int2string(clsFEGroup->getNrCellsHorizontal());
strInfo = strInfo + "\nGroup height:\t" + iqrUtils::int2string(clsFEGroup->getNrCellsVertical());
if(bCloseEnabled){
qpbtnClose = new QPushButton ( this);
qpbtnClose->setPixmap( QPixmap(close_very_small ));
qpbtnClose->setFlat(true);
qgly->addWidget(qpbtnClose, 0, 0, Qt::AlignRight | Qt::AlignTop);
connect(qpbtnClose, SIGNAL(clicked()), SLOT(slotClose()));
}
ClsQDragHandle* clsQDragHandle = new ClsQDragHandle(this);
qgly->addWidget(clsQDragHandle, 0, 0, Qt::AlignLeft | Qt::AlignTop);
connect(clsQDragHandle, SIGNAL(drag(bool)), this, SLOT(startDragging(bool)));
lblCaption->setText( clsFEGroup->getGroupName().c_str());
QToolTip::add( lblCaption, strInfo.c_str() );
qgly->addWidget (lblCaption, 1, 0, Qt::AlignHCenter | Qt::AlignVCenter ) ;
// setTitle(_clsQlstItemGroup->getGroupID());
//-------------------------------
qgrpbxStateVariables = new QGroupBox("states");
qbtngrpStateVariables = new QButtonGroup();
qlayoutStateVariables = new QVBoxLayout;
qlayoutStateVariables->setSpacing ( 0 );
qlayoutStateVariables->setContentsMargins ( 0,0,0, 0);
qgrpbxStateVariables->setLayout(qlayoutStateVariables);
int ii=0;
StateVariableList lstNeuronStateVariables = clsFEGroup->getListNeuronStateVariables( );
iqrcommon::StateVariableList::const_iterator itlstNeuronStateVariables;
for (itlstNeuronStateVariables = lstNeuronStateVariables.begin();
itlstNeuronStateVariables != lstNeuronStateVariables.end(); ++itlstNeuronStateVariables){
QAbstractButton *qrb;
ClsStateVariable *pState = *itlstNeuronStateVariables;
if(bExclusiveStates) {
qrb = new QRadioButton ( pState->getName().c_str());
}
else{
qrb = new QCheckBox ( pState->getName().c_str());
}
qrb->show();
qbtngrpStateVariables->addButton(qrb, ii );
qlayoutStateVariables->addWidget(qrb);
ii++;
}
connect(qbtngrpStateVariables, SIGNAL(buttonClicked(int)), SLOT(slotStateVariables(int)));
qbtngrpStateVariables->setExclusive ( bExclusiveStates );
//--------------------------
qgly->addWidget ( qgrpbxStateVariables, 2, 0, Qt::AlignHCenter) ;
if(bMiniGroupDisplay){
qLabelMiniGroup = new QLabel(this);
QPixmap qpm;
qpm = ClsQMiniGroup::getPixmap(clsFEGroup->getTopology(), strSelectedIndices, qgrpbxStateVariables->sizeHint().width() - 10, 100);
qLabelMiniGroup->setPixmap(qpm);
qgly->addWidget(qLabelMiniGroup, 3, 0, Qt::AlignCenter );
//.........这里部分代码省略.........