Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt 4.7 on wince, Remove form title bar, Modal window is invalid



  • 
    
    class CDlgCalibrationMain : public QDialog
    {
    	Q_OBJECT
    
    public:
    	CDlgCalibrationMain(QWidget *parent = 0);
    	~CDlgCalibrationMain();
    
    }
    
    CDlgCalibrationMain::CDlgCalibrationMain(QWidget *parent)
    	: QDialog(parent)
    {
    	ui.setupUi(this);
    	
    	//remove windows title
    	this->setWindowFlags(Qt::FramelessWindowHint);
    	//this->showMaximized();
    	//this->setWindowFlags(this->windowFlags() & ~Qt::WindowMaximizeButtonHint);
    	this->setModal(true);
    }
    
    CDlgCalibrationMain::~CDlgCalibrationMain()
    {
    
    }
    
    
    
    //
    VirtualRunQt::VirtualRunQt(QWidget *parent, Qt::WFlags flags)
    	: QMainWindow(parent, flags), m_bBootCompleted(false)
    {
    	ui.setupUi(this);
    
    	m_dlg_calibration_main = new CDlgCalibrationMain(this);
    	m_dlg_calibration_main->showNormal();
    	m_dlg_calibration_main->hide();
    
    	connect(ui.btn_calibration, SIGNAL(clicked(bool)), this, SLOT(on_clicked_btn_calibration()));
    }
    
    
    void VirtualRunQt::on_clicked_btn_calibration()
    {
    	m_dlg_calibration_main->exec();
    }
    

    when i click button call function on_clicked_btn_calibration()
    then the dialog show
    m_dlg_calibration_main->exec();

    but, i can still click other dialog's button,

    i don't know why? some could help, please!

    God bless you!



  • i use IDE is visual studio 2008,

    on windows still the problem,



  • this->setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint | Qt::SubWindow);

    can solve this problem, but Draw presence flicker



  • @CraigTao
    Please elaborate your question.
    Do you want to remove title bar from your application?



  • @CraigTao

    just add this line in projectt.cpp

        setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint | Qt::WindowTitleHint);
    

    for example in my case:

    #include "exit_lock.h"
    #include "ui_exit_lock.h"
    #include <QMessageBox>
    #include <QDebug>
    exit_lock::exit_lock(QWidget *parent) :
        QDialog(parent),
        ui(new Ui::exit_lock)
    {
        ui->setupUi(this);
        setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint | Qt::WindowTitleHint);
    
        connect(ui->zero,SIGNAL(clicked()),this,SLOT(number_check()));
        connect(ui->one,SIGNAL(clicked()),this,SLOT(number_check()));
        connect(ui->two,SIGNAL(clicked()),this,SLOT(number_check()));
        connect(ui->three,SIGNAL(clicked()),this,SLOT(number_check()));
        connect(ui->four,SIGNAL(clicked()),this,SLOT(number_check()));
        connect(ui->five,SIGNAL(clicked()),this,SLOT(number_check()));
        connect(ui->six,SIGNAL(clicked()),this,SLOT(number_check()));
        connect(ui->seven,SIGNAL(clicked()),this,SLOT(number_check()));
        connect(ui->eight,SIGNAL(clicked()),this,SLOT(number_check()));
        connect(ui->nine,SIGNAL(clicked()),this,SLOT(number_check()));
        connect(ui->clear,SIGNAL(clicked()),this,SLOT(number_check()));
    }
    
    exit_lock::~exit_lock()
    {
        delete ui;
    }
    void exit_lock::number_check()
    {
        QPushButton *any_button = (QPushButton *) sender();
    
        double storing_numbers;
    
        QString st_convert;
    
        storing_numbers = (ui->Password->text() + any_button->text()).toDouble();
    
        st_convert = QString::number(storing_numbers, 'g', 12);
    
        ui->Password->setText(st_convert);
    }
    void exit_lock::on_pushButton_clicked()
    {
      //  qDebug() << "Inside Login";
        QString password =ui->Password->text();
        if(password == "12345")
        {
            // qDebug() << " Login password is corrent";
            QMessageBox::information(this, "Login", "password is correct");
            hide(); //if not hide then when exit current window it will come back to previous window
    
          close();
        }
        else{
            // qDebug() << " Login password is not corrent";
            QMessageBox::warning(this, "Login" ,"Plese try again your password is not correct");
        }
    }
    
    
    


  • remove title bar from dialog, and can modal dialog,
    i use Qt::Dialog | Qt::FramelessWindowHint Implement function´╝î
    but . When the form is displayed, the border appears first, and then the interior of the form is displayed.



  • if use setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint | Qt::WindowTitleHint);

    2.png

    1.png

    i use setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint | Qt::SubWindow);

    3.png

    4.png

    5.png

    6.png

    if use setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint)
    perfect! but GUI not modal (i can clicked other child button),
    just code modal


Log in to reply