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;
    }

     

    
    
    
  • 相关阅读:
    debugs
    MySQL事务隔离级别详解(转)
    解决SQL Server管理器无法连接远程数据库的问题(转)
    jQuery中click(),bind(),live()的区别(转)
    各jQuery选择器的用法(转)
    使用JQuery获取对象的几种方式(转)
    HTML中元素的定位方式
    深入浅出REST(转载)
    jQuery-Selectors(选择器)的使用(二、层次篇)(转载)
    linux常用命令
  • 原文地址:https://www.cnblogs.com/sggggr/p/9214278.html
Copyright © 2011-2022 走看看