QT_7_ resource file dialog _QMessageBox_ interface layout _ _ commonly used controls

  1. resource

    1.1.  The imported resources to the project

    1.2  Add File -> Qt -> Qt Resource File

    1.3.  Since the name of  RES , generated res.qrc file

    1.4.  Right open in editor to open with an editor of the way

    1.5.  Adding prefix /

    1.6.  Add File

    1.7.  Use resource files  ": + prefix + filename "

  2. Dialog

    2.1.  Classification

    2.2  modal dialog box may not work with another window

      2.2.1. Qdialog dlg (this);

      2.2.2. dlg.exec();

    2.3.  Modeless dialog box  may operate other windows

      2.3.1. QDialog *dlg2 = new QDialog;

      2.3.2. dlg2->show();

      2.3.3  Set Properties  55 No. dlg2-> setAttribute (Qt :: WA_DeleteOnClose) ;

  3.QMessageBox

    3.1.  Eject all of the dialog boxes are modal dialog

    3.2. The  use of static member functions  can prompt a different dialog

      3.2.1  error

      3.2.2.  Warning

      3.2.3.  Information Tips

      3.2.4.  Questions prompt parameters a parent window parameter 2    window title parameter 3   message Parameter 4   Key Parameter Type 5 default association Enter button

    3.3.  Other standard dialogs

      3.3.1.  File Dialog

      3.3.2.  Color Dialog

      3.3.3.  Fonts dialog

  4. The interface layout

    4.1.  Login window interface

    4.2.  Using Widget did the control container, the container may be performed in a horizontal layout, the vertical layout, grid layout

    4.3. Widget if you modify the vertical size, vertical strategy changed to fixed

    4.4  can be modified widget gap between the controls and the default is 9 pixels

    4.5.  Spring interfacial propped

  5. Common Controls

    5.1.  Button group

      5.1.1. QPushButton Add a picture

      5.1.2. QToolButton add a picture if you want to display text toolbuttonstyle set the text and pictures are displayed together, raised effect autoRaise

      5.1.3. QRaidoButton

        5.1.3.1.  Setting selected by default

        5.1.3.2. ui->btn_man ->setChecked(true);

      5.1.4. OnCheckedBox check button

        5.1.4.1. // check button to capture affordable button selected

        5.1.4.2. connect(ui->checkBox,&QCheckBox::stateChanged,[=](int state ){qDebug()<<"state = " <<state;});

        5.1.4.3.  Select is 2   and a half selected as 1 (to set the bottom) is not selected as 0

    5.2. QlistWidget

      5.2.1  Each item is referred QListWidgetItem * item = new QListWidgetItem ( " goose goose ");

      5.2.2. ui ->listWidget->addItem(item);

      5.2.3  Set alignment  item -> setTextAlignment (Qt :: AlignHCenter );

      5.2.4.  Was added in one All

        5.2.4.1.     QStringList list;

        5.2.4.2.     list <<"11111"<<"222222222"<<"333333333"<<"44444444444";

        5.2.4.3.     ui ->listWidget ->addItems(list);

    5.3. QTreeWidget

      5.3.1  Settings head  ui-> treeWidget-> setHeaderLabels (QStringList ( ) << " Heroes " << " attribute ");

      5.3.2  Set root ui -> treeWidget-> addTopLevelItem (Litem );

      5.3.3  Add a child node Litem -> addChild (L1);

    5.4. QtableWidget

      5.4.1  Setting column ui-> tableWidget-> setColumnCount (3) ;

      5.4.2  Setting level meter ui-> tableWidget-> setHorizontalHeaderLabels (QStringList ( ) << " Name " << " gender " << " Age ");

      5.4.3  Settings row ui-> tableWidget-> setRowCount (6) ;

      5.4.4.  Setting text

        5.4.4.1. ui->tableWidget->setItem(i,col++,new QTableWidgetItem(nameList[i]));

    5.5.  Other common controls introduced

      5.5.1  Stack control ui-> stackedWidget-> setCurrentIndex (0) ;

      5.5.2  drop-down box ui -> comboBox -> addItem ( " BMW "); ui-> comboBox-> setCurrentIndex (1);

      . 5.5.3 Qlable display pictures ui-> label_image-> setPixmap (QPixmap ( ": / image / 1.jpg"));

      5.5.4  using label display movable FIG QMovie * movie = new QMovie ( " : / image / 2.gif"); movie-> start ();

    5.6.   Custom packaging

      5.6.1.  Adding class   Qt Designer interface class   .h .cpp .ui

      5.6.2.  Enhance the base class name will be filled in correctly --- add ---- lift

      5.6.3.  Use Custom Controls

      5.6.4.  Packaging signals and slots QspinBox movement, a QSlider response, a QSlider mobile   QspinBox response

      . 5.6.5  external interface getDate (); setDate ();

      5.6.6.  Test

Guess you like

Origin www.cnblogs.com/doker/p/10980709.html