本文整理汇总了C++中QSizePolicy::setRetainSizeWhenHidden方法的典型用法代码示例。如果您正苦于以下问题:C++ QSizePolicy::setRetainSizeWhenHidden方法的具体用法?C++ QSizePolicy::setRetainSizeWhenHidden怎么用?C++ QSizePolicy::setRetainSizeWhenHidden使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSizePolicy
的用法示例。
在下文中一共展示了QSizePolicy::setRetainSizeWhenHidden方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DialogyWidget
DatabaseOpenWidget::DatabaseOpenWidget(QWidget* parent)
: DialogyWidget(parent)
, m_ui(new Ui::DatabaseOpenWidget())
, m_db(nullptr)
{
m_ui->setupUi(this);
m_ui->messageWidget->setHidden(true);
QFont font = m_ui->labelHeadline->font();
font.setBold(true);
font.setPointSize(font.pointSize() + 2);
m_ui->labelHeadline->setFont(font);
m_ui->buttonTogglePassword->setIcon(filePath()->onOffIcon("actions", "password-show"));
connect(m_ui->buttonTogglePassword, SIGNAL(toggled(bool)), m_ui->editPassword, SLOT(setShowPassword(bool)));
connect(m_ui->buttonBrowseFile, SIGNAL(clicked()), SLOT(browseKeyFile()));
connect(m_ui->editPassword, SIGNAL(textChanged(QString)), SLOT(activatePassword()));
connect(m_ui->comboKeyFile, SIGNAL(editTextChanged(QString)), SLOT(activateKeyFile()));
connect(m_ui->buttonBox, SIGNAL(accepted()), SLOT(openDatabase()));
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(reject()));
#ifdef WITH_XC_YUBIKEY
m_ui->yubikeyProgress->setVisible(false);
QSizePolicy sp = m_ui->yubikeyProgress->sizePolicy();
sp.setRetainSizeWhenHidden(true);
m_ui->yubikeyProgress->setSizePolicy(sp);
connect(m_ui->buttonRedetectYubikey, SIGNAL(clicked()), SLOT(pollYubikey()));
connect(m_ui->comboChallengeResponse, SIGNAL(activated(int)), SLOT(activateChallengeResponse()));
#else
m_ui->checkChallengeResponse->setVisible(false);
m_ui->buttonRedetectYubikey->setVisible(false);
m_ui->comboChallengeResponse->setVisible(false);
m_ui->yubikeyProgress->setVisible(false);
#endif
#ifdef Q_OS_MACOS
// add random padding to layouts to align widgets properly
m_ui->dialogButtonsLayout->setContentsMargins(10, 0, 15, 0);
m_ui->gridLayout->setContentsMargins(10, 0, 0, 0);
m_ui->labelLayout->setContentsMargins(10, 0, 10, 0);
#endif
#ifndef WITH_XC_TOUCHID
m_ui->checkTouchID->setVisible(false);
#else
if (!TouchID::getInstance().isAvailable()) {
m_ui->checkTouchID->setVisible(false);
}
#endif
}
示例2: cardIndicesSelectRequested
GridCardViewerWidget::GridCardViewerWidget( ImageLoaderFactory* imageLoaderFactory,
const Logging::Config& loggingConfig,
QWidget* parent )
: CardViewerWidget( imageLoaderFactory, loggingConfig, parent ),
mGridCardsLayout( nullptr ),
mWaitingForTurn( false )
{
// Create column buttons.
for( int col = 0; col < 3; ++col )
{
for( bool top : { true, false } )
{
GridToolButton* button = new GridToolButton();
button->setArrowType( top ? Qt::DownArrow : Qt::UpArrow );
button->setText( "Select Column" );
button->setToolButtonStyle( Qt::ToolButtonTextBesideIcon );
button->setToolTip( tr("Select column %0").arg(col+1) );
// Keep the layout from jerking around when buttons are hidden.
QSizePolicy sizePolicy = button->sizePolicy();
sizePolicy.setRetainSizeWhenHidden( true );
button->setSizePolicy( sizePolicy );
connect( button, &GridToolButton::mouseEntered, [this,col]() {
for( auto i : getColSelectableIndices( col ) )
{
if( i < mCardWidgetsList.size() ) mCardWidgetsList[i]->setHighlighted( true );
}
} );
connect( button, &GridToolButton::mouseExited, [this,col]() {
for( auto i : getColIndices( col ) )
{
if( i < mCardWidgetsList.size() ) mCardWidgetsList[i]->setHighlighted( false );
}
} );
connect( button, &QToolButton::clicked, [this,col]() {
QList<int> indices = QList<int>::fromSet( getColSelectableIndices( col ) );
emit cardIndicesSelectRequested( indices );
} );
if( top )
{
mTopColButtons[col] = button;
}
else
{
mBottomColButtons[col] = button;
}
}
}
// Create row buttons.
for( int row = 0; row < 3; ++row )
{
for( bool left : { true, false } )
{
GridToolButton* button = new GridToolButton();
button->setArrowType( left ? Qt::RightArrow : Qt::LeftArrow );
button->setText( "Select\nRow" );
button->setToolButtonStyle( Qt::ToolButtonTextUnderIcon );
button->setToolTip( tr("Select row %0").arg(row+1) );
connect( button, &GridToolButton::mouseEntered, [this,row]() {
for( auto i : getRowSelectableIndices( row ) )
{
if( i < mCardWidgetsList.size() ) mCardWidgetsList[i]->setHighlighted( true );
}
} );
connect( button, &GridToolButton::mouseExited, [this,row]() {
for( auto i : getRowIndices( row ) )
{
if( i < mCardWidgetsList.size() ) mCardWidgetsList[i]->setHighlighted( false );
}
} );
connect( button, &QToolButton::clicked, [this,row]() {
QList<int> indices = QList<int>::fromSet( getRowSelectableIndices( row ) );
emit cardIndicesSelectRequested( indices );
} );
if( left )
{
mLeftRowButtons[row] = button;
}
else
{
mRightRowButtons[row] = button;
}
}
}
}