首页| 论坛| 消息

回复: 有高人告诉我QT4.4 如何在屏幕上添加按钮或标签项吗?
#6 [fanzhichao 09-03 17:30]
靠,我也被忽悠了,没看清就。。。
sorry,应该是
app.setMainWidget(&hello);
其实你看看例子就知道了。。。。
sigh。。。。
#7 [oneke 09-03 17:47]
哦,楼上的老兄,这个好像用不成
我用的是QT4.4的平台,已经取消了setMainWidget函数~
有人知道么?
#8 [blackshirt 09-04 09:45]
我昨天那个还是不能正常显示图像,我的代码是这样,里面加了你说的那两个函数,帮看看
#include
#include
#include
#include
#include
#include
int main(int argc, char *argv[])
{
QApplication app(argc, argv, QApplication::GuiServer);
//app.setGeometry(0,0,900,700);

QPalette palette;
QBrush *BackColor = new QBrush(QColor(58,110,160)); //设置背景颜色
QWSServer::setBackground(*BackColor); //应用背景颜色
palette.setColor(QPalette::Active,static_cast (1),QColor(255,0,0));

QPushButton quit("Quit");
quit.setPalette(palette);
quit.setAutoFillBackground(true);

int screenWidthM=app.desktop()->size().width();
int screenHeightM=app.desktop()->size().height();
quit.setGeometry(0,0,screenWidthM,screenHeightM);
quit.setFont(QFont("Times", 18, QFont::Bold));
QObject::connect(&quit, SIGNAL(clicked()), &app, SLOT(quit()));
quit.show();
app.exec();
return 0;
}
这样运行后还是 出下鼠标,然后绿屏....
#9 [oneke 09-04 10:11]
不是吧,我把你的代码原封不动的Copy过去,运行时显示的是蓝色呀~
你是不是在别的地方又改动了设置呢?
你上面说的动了鼠标~?这段程序中貌似没有鼠标的事件驱动代码吧
还有就是这段代码在你的板上运行后,除了背景还有其它的控件显示吗?
#10 [suraid 09-04 10:58]
连顶楼的那段代码都出不来?
是不是你没有正确安装字体啊?

<< 1 2 3 4 >> (2/5)

回复 发表
主题 版块