本文整理汇总了C++中QPushButton::adjustSize方法的典型用法代码示例。如果您正苦于以下问题:C++ QPushButton::adjustSize方法的具体用法?C++ QPushButton::adjustSize怎么用?C++ QPushButton::adjustSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPushButton
的用法示例。
在下文中一共展示了QPushButton::adjustSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setCurrentIndex
void HorizontalTabWidget::setCurrentIndex(int index)
{
int xPos = 0;
for(unsigned i = 0; i < m_tabButtons.size(); i++)
{
QPushButton * button = m_tabButtons[i];
QString style;
style.append("QPushButton { border: none; background-color: #808080; ");
style.append(" border-right: 1px solid black;");
style.append(" border-bottom: 1px solid black;");
style.append(" padding-left: 10px;");
style.append(" padding-right: 10px;");
style.append(" padding-top: 5px;");
style.append(" font: bold;");
if( i == m_tabButtons.size() - 1 )
{
style.append(" border-right: none;");
}
style.append("}");
button->setStyleSheet(style);
button->adjustSize();
button->move(xPos,0);
xPos = xPos + button->width();
}
m_tabBarLine->setFixedWidth(xPos);
m_tabBarLine->raise();
QPushButton * button = m_tabButtons[index];
QString style;
// NOTE: Yellow Orange Lighter #fdbc3b and the Darker Orange is #f47920
style.append("QPushButton { border: none; background-color: #f47920; ");
style.append(" border-right: 1px solid black;");
style.append(" padding-left: 10px;");
style.append(" padding-right: 10px;");
style.append(" padding-top: 5px;");
style.append(" font: bold;");
if( index == int(m_tabButtons.size() - 1) )
{
style.append(" border-right: none;");
}
style.append("}");
button->setStyleSheet(style);
button->raise();
emit tabSelected(m_ids[index]);
}
示例2: setCurrentIndex
void HorizontalTabWidget::setCurrentIndex(int index)
{
int xPos = 0;
for(unsigned i = 0; i < m_tabButtons.size(); i++)
{
QPushButton * button = m_tabButtons[i];
QString style;
style.append("QPushButton { border: none; background-color: #808080; ");
style.append(" border-right: 1px solid black;");
style.append(" border-bottom: 1px solid black;");
style.append(" padding-left: 10px;");
style.append(" padding-right: 10px;");
style.append(" padding-top: 5px;");
style.append(" color: white;");
if( i == m_tabButtons.size() - 1 )
{
style.append(" border-right: none;");
}
style.append("}");
button->setStyleSheet(style);
button->adjustSize();
button->move(xPos,0);
xPos = xPos + button->width();
}
m_tabBarLine->setFixedWidth(xPos);
m_tabBarLine->raise();
QPushButton * button = m_tabButtons[index];
QString style;
style.append("QPushButton { border: none; background-color: #95B3DE; ");
style.append(" border-right: 1px solid black;");
style.append(" padding-left: 10px;");
style.append(" padding-right: 10px;");
style.append(" padding-top: 5px;");
style.append(" color: white;");
if( index == int(m_tabButtons.size() - 1) )
{
style.append(" border-right: none;");
}
style.append("}");
button->setStyleSheet(style);
button->raise();
m_pageStack->setCurrentIndex(index);
}
示例3: setCurrentIndex
void MainTabView::setCurrentIndex(int index)
{
int xPos = m_tabLabel->width() + TAB_SEPARATION;
for(unsigned i = 0; i < m_tabButtons.size(); i++)
{
QPushButton * button = m_tabButtons[i];
QString style;
style.append("QPushButton { border: none; background-color: #BBCDE3; ");
style.append(" border-right: 1px solid black;");
style.append(" border-bottom: 1px solid black;");
style.append(" border-top: 1px solid black;");
style.append(" border-left: 1px solid black;");
style.append(" border-top-left-radius: 5px;");
style.append(" border-top-right-radius: 5px;");
style.append(" padding-left: 10px;");
style.append(" padding-right: 10px;");
style.append(" color: black;");
style.append("}");
button->setStyleSheet(style);
button->adjustSize();
button->move(xPos,5);
button->stackUnder(m_mainWidget);
xPos += TAB_SEPARATION + button->width();
}
QPushButton * button = m_tabButtons[index];
QString style;
style.append("QPushButton { border: none; background-color: #E6E6E6; ");
style.append(" border-right: 1px solid black;");
style.append(" border-bottom: none;");
style.append(" border-top: 1px solid black;");
style.append(" border-left: 1px solid black;");
style.append(" border-top-left-radius: 5px;");
style.append(" border-top-right-radius: 5px;");
style.append(" padding-left: 10px;");
style.append(" padding-right: 10px;");
style.append(" color: black;");
style.append("}");
button->setStyleSheet(style);
button->raise();
m_stackedWidget->setCurrentIndex(index);
emit tabSelected(m_ids[index]);
}