1. Transparent interface
Setwindowopacity (0.8); // The constructor adds this sentence, 1 is opaque, 0 is completely transparent, and 0.8 is 80% opaque.
2. Set the background image
Qpixmap pixmap = Qpixmap (":/image/background"). Scaled (this,size ()); Qpalette Palette (This, this,setpalette (palette); /* first add the background to the resource file, note to put the file in an extra copy in the Qtcreator compiled directory, the size is self-adapting, it is recommended to use only PNG images, no installation/other plugins. */
3. Set window No border
setwindowflags (qt::framelesswindowhint); // In the constructor, you can make the window borderless, noting that the window cannot be moved.
4. Set the form to move
voidMainwindow::mousepressevent (Qmouseevent *Event){ if(Event->button () = =Qt::leftbutton) {M_drag=true; M_dragposition=Event->globalpos ()- This-POS (); Event-accept (); }}voidMainwindow::mousemoveevent (Qmouseevent *Event){ if(M_drag && (Event->buttons () &&Qt::leftbutton)) {Move (Event->globalpos ()-m_dragposition); Event-accept (); }}voidMainwindow::mousereleaseevent (Qmouseevent *) {M_drag=false;}//Add These three signals after adding <QMouseEvent> in the header file.
5. Set the input box to password mode
Lineedit_2->setechomode (qlineedit::P assword); // through this section, you can get the password display effect such as:
Tips for QT Forms