zoukankan      html  css  js  c++  java
  • Qt5学习(1)

    1. In Qt, if you want to apply styles to the main window  itself, you must apply it to 

      its central widget instead of the main window itself because the window is just
      a container.

    2.设计时先添加垂直布局,再添加水平布局。

      固定控件大小时,把水平政策和垂直政策设为‘’‘fixed’,然后在mininum里输入大小。

    3.布局 只有margin属性,可以 ‘’变形为’’ Widget,以求调整大小。

    4 Qt的样式表跟CSS语法一样

    5新建qt资源文件

    To add a new .qrc file to our project, go to File | New File or Project. Then, select Qt under
    the Files and Classes category and select Qt Resources File. After that, give it a name (that
    is, resources) and click the Next button followed by the Finish button. The .qrc file will not
    be created and automatically opened by Qt Creator。

    6. Add Prefix   给资源文件添加目录

    7.设置button的icon属性。改变iconsize来改变大小

     pixmap属性  :You will now see the logo size no longer follow the dimension you set previously and follow the actual dimension of the image instead. We cannot change its dimension because this is simply how pixmap works。

    8要想不用pixmap的方式  border-image: url(:/images/logo.png); 

    复制路径:To obtain the path of the image, right click the image name on the file list window 

    and choose Copy path.

    9pseudo states:

    例如:

    QPushButton:hover
    {
     color: white;
     background-color: #66c011;
     border- 0px;
     border-radius: 3px;
    }
    

      进一步自定义属性

    QPushButton[pagematches=true]
    {
     color: white;
     background-color: red;
     border- 0px;
     border-radius: 3px;
    }

    然后再mainwindow.cpp的构造函数下:

     ui->pushButton->setProperty("pagematches",true);
    

    读属性: QObject::property().

    10  sub-controls(用双引号引入)

    QSpinBox::down-button
    { image: url(:/images/spindown.png);
      subcontrol-origin: padding;
      subcontrol-position: right bottom;
    }

     

    
    
    
  • 相关阅读:
    高阶函数
    js严格模式
    改变函数内this指向方法——call、apply、bind
    vue动态组件
    微信支付接口IP获取与调用之统一下单
    node.js实现微信公众号支付
    微信支付(公众号支付JSAPI)--转载
    公众号微信支付流程-(转)
    python 3 代码一模一样,出现运行结果不同的情况(只是不以为一样而已)
    pycharm设置自动换行
  • 原文地址:https://www.cnblogs.com/sggggr/p/9214278.html
Copyright © 2011-2022 走看看