[問題] qt 初始化畫面問題
開發平台(Platform): (Ex: Win10, Linux, ...)
win7
編譯器(Ex: GCC, clang, VC++...)+目標環境(跟開發平台不同的話需列出)
vs2015
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
qt5.7
問題(Question):
我需要等到讀到 usb上接的東西回傳序號之後才開始畫畫面
UART to USB
所以我在讀完序列號之後送出一個signal讓畫面初始化
connect(this,signal(getSN),this,slot(initView));
void myclass::initView(){
QPushButton *btn = new QPushbutton(this);
...
...
};
用debug模式下去看會跑進來initView這個slot
但畫面上完全看不到任何東西
不知道這有解嗎
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 1.169.79.56
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1493120346.A.5B0.html
推
04/25 21:05, , 1F
04/25 21:05, 1F
→
04/25 21:08, , 2F
04/25 21:08, 2F
→
04/25 21:08, , 3F
04/25 21:08, 3F
→
04/25 21:15, , 4F
04/25 21:15, 4F
→
04/25 21:15, , 5F
04/25 21:15, 5F
→
04/25 21:31, , 6F
04/25 21:31, 6F
→
04/25 21:32, , 7F
04/25 21:32, 7F
→
04/25 21:32, , 8F
04/25 21:32, 8F
後來發現是要用show()這個指令 東西就出來了
void myclass::initView(){
QPushButton *btn = new QPushbutton(this);
btn->show();
};
不在最上層畫畫面的時候 好像就要用show();
不知道為什麼!?
myClass::myClass(QWidget *parent)
: QMainWindow(parent){
ui.setupUi(this);
QPushButton *btn = new QPushbutton(this);
}
※ 編輯: MOONY135 (59.124.46.66), 04/26/2017 11:02:23
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章