当前位置: 首页>>代码示例>>C++>>正文


C++ QStackedWidget::setContentsMargins方法代码示例

本文整理汇总了C++中QStackedWidget::setContentsMargins方法的典型用法代码示例。如果您正苦于以下问题:C++ QStackedWidget::setContentsMargins方法的具体用法?C++ QStackedWidget::setContentsMargins怎么用?C++ QStackedWidget::setContentsMargins使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QStackedWidget的用法示例。


在下文中一共展示了QStackedWidget::setContentsMargins方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: initUI

void QTodoManager::initUI()
{
    QGridLayout *grid = new QGridLayout(this);
    QWidget *closew = new QWidget(this);
    IconButton *closeB = QAppUtils::ref().getCloseIconBtn(closew);
    QHBoxLayout *hlay = new QHBoxLayout(closew);

    QWidget *tipw = new QWidget(this);
    QVBoxLayout *tiplay = new QVBoxLayout(tipw);
    m_lbtip = new QLabel(tipw);
    tiplay->addWidget(m_lbtip);
    m_lbtip->setText(LOCAL("当前位置>>"));

    hlay->addWidget(closeB);
    connect(closeB,SIGNAL(clicked()),this,SLOT(close()));
    m_stacked =   new QStackedWidget(this);
    m_wid_alldo = new QToDoContent(this);//QWinFactory::ref().createWindow(QWinFactory::Widget);
    m_wid_alldo->setTitle(QStringList()<<LOCAL("所有事项")<<LOCAL("选择"));

    m_wid_todo =  new QToDoContent(this,QToDoContent::ToDo);//QWinFactory::ref().createWindow(QWinFactory::Widget);
    m_wid_todo->setTitle(QStringList()<<LOCAL("待办事项")<<LOCAL("选择"));

    m_wid_done =  new QToDoContent(this,QToDoContent::Done);//QWinFactory::ref().createWindow(QWinFactory::Widget);
    m_wid_done->setTitle(QStringList()<<LOCAL("已办事项")<<LOCAL("选择"));

    m_wid_alldo->flushData(QToDoData::ref().getAll());
    //按钮
    m_allcando = new QPureColorButton(this);
    m_todobtn  = new QPureColorButton(this);
    m_donebtn  = new QPureColorButton(this);

    m_allcando->setButtonText(LOCAL("全部事项"));
    m_todobtn->setButtonText(LOCAL("待办事项"));
    m_donebtn->setButtonText(LOCAL("已办事项"));

    m_allcando->setIndex(ALLTask);
    m_todobtn->setIndex(ToDoTask);
    m_donebtn->setIndex(DoneTask);

    connect(m_allcando,SIGNAL(clicked(int)),this,SLOT(stack_change(int)));
    connect(m_todobtn,SIGNAL(clicked(int)),this,SLOT(stack_change(int)));
    connect(m_donebtn,SIGNAL(clicked(int)),this,SLOT(stack_change(int)));

    m_allcando->setColors(QColor(0,0,100),QColor(0,200,200)
                          ,QColor(0,100,100),QColor(0,150,150));

    m_todobtn->setColors(QColor(0,0,100),QColor(0,200,200)
                          ,QColor(0,100,100),QColor(0,150,150));
    m_donebtn->setColors(QColor(0,0,100),QColor(0,200,200)
                          ,QColor(0,100,100),QColor(0,150,150));

    QStackedWidget *stacked = m_stacked;
    stacked->setContentsMargins(0,0,0,0);
    stacked->addWidget(m_wid_alldo);
    stacked->addWidget(m_wid_todo);
    stacked->addWidget(m_wid_done);

    grid->setSpacing(5);
    grid->setContentsMargins(0,0,0,10);
    grid->addWidget(tipw,0,0,1,1);
    grid->addWidget(closew,0,2,1,1,Qt::AlignRight);
    grid->addWidget(stacked,1,0,1,3);
    grid->addWidget(m_allcando,2,0,1,1);
    grid->addWidget(m_todobtn,2,1,1,1);
    grid->addWidget(m_donebtn,2,2,1,1);

}
开发者ID:xiaojianwu,项目名称:QtDeskTop,代码行数:67,代码来源:qtodomanager.cpp


注:本文中的QStackedWidget::setContentsMargins方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。