QT development FAQ summary

报错“no rule to make target xx.cpp, needed by xx.o”

insert image description here

UI interface for loop suspended animation

insert image description here

QT relative address

● $$PWD is the address in the same directory of .pro;
● When loading a relative address in the code, the loading in the mac fails, so the relative address is converted to an absolute address; it is mainly necessary to make a copy, or not Double quotes, don't know why;
insert image description here

Add background image to the interface

insert image description here

play gif

insert image description here

Modal and Modeless Dialogs

● According to whether it can also interact with other windows of the program when running the dialog box, the dialog box is usually divided into two types: modal and modeless
modal dialog box
   ○ modal dialog box is You cannot interact with other windows of the same application until you close it.
   ○ Create a modal dialog box–1
      ■ QDialog dialog(this); dialog.exec();
     ■ After executing this code, the dialog box pops up first, but the original window does not come out. After closing the dialog box, the original dialog box The box pops up.
  ○ Create modal dialog box–2
    ■ QDialog *dialog = new QDialog(this); dialog->setModal(true);dialog->show(); ■
    After executing this code, both the dialog box and the window come out, this It is because the control right will be handed over to the caller immediately after calling the show() function, so the program can continue to execute and the window will pop up. The exec() function is different, it only returns when the dialog box is closed.
Modeless dialog box
  ○ Modeless dialog box can interact with other windows of the same application.
  ○ QDialog *dialog = new QDialog(this); dialog->show();
  ○ Use the new operation to open up the memory space. Dialog boxes and windows are relatively independent.

Guess you like

Origin blog.csdn.net/yanceyxin/article/details/126453936