1. Add the background code of the window:
Qimage image1;
Image1.load (":/1.png"); // The relative directory of the image in parentheses
Qimage image2 = image1.scaled (320,240 );
Qpalette palette;
Palette. setbrush (this-> backgroundrole (), qbrush (image2 ));
This-> setpalette (palette );
Or
Qpalette palette;
Palette. setbrush (this-> backgroundrole (), qbrush (qpixmap (":/1png"); // The relative directory of the image in parentheses
This-> setpalette (palette );
2. Set the font size code:
Qfont font ("wenquanyi ",14);
Widget Object Name-> Setfont (Font);
Example: button-> setfont (Font);
3. Internationalization: in the main () functionW. Show ();Code prefix
Qtextcodec: setcodecfortr (qtextcodec: codecforname ("GBK "));
Qtextcodec: setcodecforlocale (qtextcodec: codecforname ("GBK "));
Qtextcodec: setcodecforcstrings (qtextcodec: codecforname ("GBK "));
4. Add an image for the Widget:
Method 1:
Widget Object Name-> Setstylesheet ("border-image: URL (:/1.png); "); // The relative directory of the image in parentheses
Method 2:
Widget Object Name-> Seticon (qicon (":/1.png"); // The relative directory of the image in parentheses
Widget Object Name-> Seticonsize (qsize (100,100); // you can specify the image size.
Method 3:
Widget Object Name-> Setstylesheet ("background-image: URL (:/1.png); "); // The relative directory of the image in parentheses
Observe the differences between the three methods through self-programming;