QT에서 버튼을 클릭하고 창이 팝업되면 사용자는 계속 돌아가 동일한 버튼을 클릭 할 수 있습니다 (무한 시간). 버튼에서 튀어 나오는 창이 다른 창 위에 놓 이도록 어떻게 만들 수 있습니까? 이 경우 창을 팝업하는 것은 "편집"버튼입니다. EditWindow
가 대신 쇼의 간부 인 방법을 호출 할 수있는 QDialog
경우 여기QT에서 팝업 창을 최상위 창으로 만드는 방법은 무엇입니까?
는 window.cpp
#include "window.h"
#include "editwindow.h"
#include "ui_window.h"
#include <QtGui/QApplication>
#include <QtGui>
Window::Window(QWidget *parent) :
QDialog(parent),
ui(new Ui::Window)
{
ui->setupUi(this);
ShowEdit = new QPushButton(tr("Edit"));
ShowEdit -> show();
connect(ShowEdit, SIGNAL(clicked()), this, SLOT(popup()));
Remove = new QPushButton(tr("Remove"));
Remove -> show();
connect(Remove, SIGNAL(clicked()), this, SLOT(ProgramRemove()));
OK = new QPushButton(tr("OK"));
OK -> show();
connect(OK, SIGNAL(clicked()), this, SLOT(Saved()));
Quit = new QPushButton(tr("Quit"));
Quit -> show();
connect(Quit, SIGNAL(clicked()), this, SLOT(close()));
QLabel *tableLabel = new QLabel(tr("All Programs"));
QVBoxLayout *buttonLayout2 = new QVBoxLayout;
buttonLayout2 -> addWidget(ShowEdit);
buttonLayout2 -> addWidget(Remove);
//buttonLayout2 -> addStretch();
QHBoxLayout *buttonLayout2_2 = new QHBoxLayout;
buttonLayout2_2 -> addWidget(Quit);
buttonLayout2_2 -> addWidget(OK);
/*******************************************************************************/
/***************************Below is for Table**********************************/
/*******************************************************************************/
PTable = new QTableWidget(10, 10);
//PTable ->setHorizontalHeader(tr("Program Names"));
//inputs->setText(QString::number(row));
//PTable->setItem(row, column, inputs);
QHBoxLayout *PTableLayout = new QHBoxLayout;
PTableLayout ->addWidget(PTable);
/*------------------------------------------------------------------------------*/
/*------------------------construct window--------------------------------------*/
/*------------------------------------------------------------------------------*/
QGridLayout *SecondLayout = new QGridLayout;
SecondLayout -> addWidget(tableLabel, 0, 0);
SecondLayout -> addLayout(PTableLayout, 1, 0);
SecondLayout -> addLayout(buttonLayout2, 0, 1);
SecondLayout -> addLayout(buttonLayout2_2, 2, 0);
setLayout(SecondLayout);
setWindowTitle(tr("Settings"));
}
Window::~Window()
{
delete ui;
}
void Window :: popup()
{
EditWindow* window_3 = new EditWindow(this);
window_3->move(QPoint(550, 100));
window_3->show();
window_3->raise();
}
void Window :: closeBoth()
{
return;
}
void Window :: Saved()
{
return;
}
void Window :: ProgramRemove()
{
return;
}
void Window :: popup()'에 넣으면 프로그램이 종료됩니다. 나는 또한'window_3 -> show();를 주석 처리했다. – Chris