Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5956343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:14:37+00:00 2026-05-22T18:14:37+00:00

I am trying to make a form with data table appear when the button

  • 0

I am trying to make a form with data table appear when the button is clicked on thr main form. However, in practice second form ‘blinks’ – appears less than on second – and then vanished. What could be the reason and how that should be fixed?

Here is the derived form header and source files’ content:

#ifndef GOODTABLE_H
#define GOODTABLE_H

#include <QDialog>
#include <QSqlTableModel>
namespace Ui {
    class GoodTable;
}

class GoodTable : public QDialog
{
    Q_OBJECT

public:
    explicit GoodTable(QDialog *parent = 0);
    GoodTable(QDialog *parent,QSqlTableModel* model);
    ~GoodTable();

private:
    Ui::GoodTable *ui;
};

#endif // GOODTABLE_H

#include "goodtable.h"
#include "ui_goodtable.h"

GoodTable::GoodTable(QDialog *parent) :
    QDialog(parent),
    ui(new Ui::GoodTable)
{
    ui->setupUi(this);
}
GoodTable::GoodTable(QDialog *parent,QSqlTableModel* model) :
    QDialog(parent),
    ui(new Ui::GoodTable)
{
    ui->setupUi(this);
    ui->tableView->setModel(model);
}
GoodTable::~GoodTable()
{
    delete ui;
}

The code creating second window:

void MainWindow::on_goodTable_clicked()
{
    QSqlTableModel model;

    initializeGoodModel(&model);
    //! [4]
    GoodTable view(NULL,&model);
    view.setWindowFlags(Qt::Window);
    view.setWindowModality(Qt::ApplicationModal);
    view.show();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T18:14:37+00:00Added an answer on May 22, 2026 at 6:14 pm

    The problem is, that you have a local dialog object on the stack in your on_goodTable_clicked method. So you create the view, call show, which shows the dialog and immediately returns, then your view get’s destroyed as you leave the function. If you make the dialog modal anyway, why not use QDialog‘s exec method intead of show. It shows the dialog and blocks the main window until you clicked the dialog’s Ok or cancel button and then exec finally returns. When you want a non-modal dialog (meaning your main window works, while the dialog is open), you need to create your dialog dynamically (or make it a member of your main window, or both).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make update form, that is going to retrieve the data for
I am trying to bind my data table inventorytable to the datagrid viewer.the problem
I'm trying to make my contact form submission process work equally well whether the
I'm trying to make a dynamically sizable title banner, using fairly simple image tricks.
I'm trying to make a simple MySQL Admin thing with php and jQuery. I've
This is my first time I am trying to make something seriously with relational
i am having an form for uploading an excel file like <form enctype=multipart/form-data action=http://localhost/joomla/Joomla_1.5.7/index.php?option=com_jumi&fileid=7
I'm trying to make two forms that aren't displayed at the same time. The
Easy question this time. I'm trying to test whether or not a string does
this may sound kind of convoluted but basically i want to have a form

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.