Qt 将程序启动时的绿屏改为图片 去除标题栏和边框 修改EXE可执行文件ICO图标

Qt 将程序启动时的绿屏改为图片
在QApplication 实例之前,
QImage img("xx.png");
if (!img.isNull())
{qwsServer->setDesktopBackground(img);}
Qt 如何去除标题栏和边框
先声明窗体类myclass继承于QWidget,定义其构造函数
myclass(QWidget *parent = 0, const char *name = 0 )
然后使该函数继承于QWidget( parent, name, WFlags f),这里的 f 标志定义了窗体的风格。
Qt::WStyle_Customize | Qt::WStyle_NoBorder就定义了窗体无标题栏,其它标志可以查询Qt助手。
class myclass:public QWidget
{
    public:
        myclass(QWidget *parent = 0, const char *name = 0 );
};
myclass::myclass(QWidget *parent, const char *name)
    : QWidget( parent, name, Qt::WDestructiveClose |
            Qt::WStyle_Customize | Qt::WStyle_NoBorder)
{
.....
}
setWindowFlags(Qt::FramelessWindowHint);
Qt 修改EXE可执行文件ICO的图标
Setting the Application Icon on Windows

First, create an ICO format bitmap file that contains the icon image. This can be done with e.g. Microsoft Visual C++: Select File|New, then select the File tab in the dialog that appears, and choose Icon. (Note that you do not need to load your application into Visual C++; here we are only using the icon editor.)

Store the ICO file in your application's source code directory, for example, with the name myappico.ico. Then, create a text file called, say, myapp.rc in which you put a single line of text:

IDI_ICON1 ICON DISCARDABLE "myappico.ico"
Finally, assuming you are using qmake to generate your makefiles, add this line to your myapp.pro file:

RC_FILE = myapp.rc
Regenerate your makefile and your application. The .exe file will now be represented with your icon in Explorer.

If you do not use qmake, the necessary steps are: first, run the rc program on the .rc file, then link your application with the resulting .res file.


发表于:2012-08-12 08:20:18

原文链接(转载请保留): http://www.multisilicon.com/blog/a30202830.html

友情链接: MICROIC
首页