资源简介

实现QScrollArea中嵌套QGridLayout,同时放缩窗口动态改变QGridLayout中的元素大小,上传小栗子积分!

资源截图

代码片段和文件信息

#include “widget.h“
#include 

int main(int argc char *argv[])
{
    QApplication a(argc argv);
    CScrollArea w;
    w.show();

    return a.exec();
}

//#include 
//#include 
//#include 
//#include 
//#include 
//#include 
//#include 
//#include 

////构造函数初始化布局控件
//class Drawer:public QToolBox{
//public:
//    Drawer(){
//        //设置标题
//        setWindowtitle(tr(“QQ“));
//        //创建一个 QGroupBox 对象
//        QGroupBox *groupBox1=new QGroupBox(this);
//        //创建按钮1
//        toolButton1_1=new QToolButton;
//        toolButton1_1->setText(tr(“test1“));
//        toolButton1_1->setAutoRaise(true);  //鼠标离开时 按钮恢复到谈起状态
//        toolButton1_1->setToolButtonstyle(Qt::ToolButtonIconOnly); //文字显示在图标下面
//        toolButton1_1->setIcon(QIcon(“D:/projects/Branches/code/bin/res/general/logo.png“));
//        toolButton1_1->setMinimumSize(200100);
//        toolButton1_1->setIconSize(QSize(15050));

//        //创建一个 QGroupBox 对象
//        QGroupBox *groupBox2=new QGroupBox(this);
//         //创建按钮二
//        toolButton1_2=new QToolButton;
//        toolButton1_2->setText(tr(“test2“));
//        toolButton1_2->setAutoRaise(true);
//        toolButton1_2->setToolButtonstyle(Qt::ToolButtonTextUnderIcon);

//        //第一个抽屉
//        QVBoxLayout *layout1=new QVBoxLayout(groupBox1);
//        layout1->setMargin(10);
//        layout1->setAlignment(Qt::AlignHCenter);
//        layout1->addWidget(toolButton1_1);
//        //第二个抽屉
//        QVBoxLayout *layout2=new QVBoxLayout(groupBox2);
//        layout2->setMargin(10);
//        layout2->setAlignment(Qt::AlignHCenter);
//        layout2->addWidget(toolButton1_2);
//        //把抽屉插入到 QToolBox中
//        this->addItem((QWidget *)groupBox1tr(“userName“));
//        this->addItem((QWidget *)groupBox2tr(“homePage“));
//        connect(toolButton1_1SIGNAL(clicked())thisSLOT(slotCls()));
//    }
//    void slotCls(){
//        QMessageBox *msg=new QMessageBox(this);
//        msg->setText(“user name is Riren“);
//        msg->exec();
//    }

//    QToolButton *toolButton1_1;
//    QToolButton *toolButton1_2;
//};

//int main(int argcchar ** argv){
//    QApplication app(argcargv);
//    Drawer drawc;
//    drawc.show();
//    return app.exec();
//}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2570  2019-06-11 15:36  ScrollView\main.cpp

     文件        346  2019-06-11 10:48  ScrollView\ScrollView.pro

     文件      14028  2019-06-11 10:52  ScrollView\ScrollView.pro.user

     文件       2224  2019-06-11 15:38  ScrollView\widget.cpp

     文件        775  2019-06-11 15:36  ScrollView\widget.h

     目录          0  2019-06-11 15:38  ScrollView

----------- ---------  ---------- -----  ----

                19943                    6


评论

共有 条评论

相关资源