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 8496879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:58:16+00:00 2026-06-10T23:58:16+00:00

In qdialog i put some input that i need in the mainwindow, how can

  • 0

In qdialog i put some input that i need in the mainwindow, how can i get them? my program is something like this, I have a qdialog that must open before mainwindow, I put there some input and click ok, and then the mainwinodw opens using those inputs.

here’s the dialog.cpp code:

#include "dialog.h"
#include "ui_dialog.h"

#include "vtkBMPReader.h"

// Define the length of the volume
void Dialog::bmprange()
{
// Getting some proprieties for the lenght of the volume
QString XMAX=ui->lineEdit->text();
double xMax=XMAX.toDouble();
QString YMAX=ui->lineEdit_2->text();
double yMax=YMAX.toDouble();
QString ZMAX=ui->lineEdit_3->text();
double zMax=ZMAX.toDouble();
QString XMMAX=ui->lineEdit_4->text();
double xMMax=XMMAX.toDouble();
QString YMMAX=ui->lineEdit_5->text();
double yMMax=YMMAX.toDouble();
QString ZMMAX=ui->lineEdit_6->text();
double zMMax=ZMMAX.toDouble();

if (xMax==0 || yMax==0 || zMax==0 || xMMax==0 || yMMax==0 || zMMax==0)
{
    ui->label_17->setText("Error: invalid measures");
}
else
{
// Using vtkBMPReader to read all the 128 bmp slices
  vtkBMPReader *bmp= vtkBMPReader::New();
    bmp->SetDataByteOrderToLittleEndian();
    bmp->SetFilePrefix ("/home/matt/Desktop/ouBMP/exemplo");
    bmp->SetFilePattern("%s%d.bmp");
    bmp->SetFileNameSliceSpacing(1);
    bmp->SetNumberOfScalarComponents(3);
    bmp->SetDataOrigin(0,0,0);
    bmp->SetDataSpacing(xMMax/(xMax-1.0),xMMax/(yMax-1.0),xMMax/(zMax-1.0));
    bmp->SetDataExtent(0,xMax-1.0,0,yMax-1.0,1,zMax);
    bmp->Update();
    ui->label_17->setText("Valid measures");
}
}

Dialog::Dialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Dialog)
{
    ui->setupUi(this);

  // Control volume measures
    // Making the lineedit objects only accept numbers
    ui->lineEdit->setValidator(new QIntValidator(this));
    ui->lineEdit_2->setValidator(new QIntValidator(this));
    ui->lineEdit_3->setValidator(new QIntValidator(this));
    ui->lineEdit_4->setValidator(new QDoubleValidator(this));
    ui->lineEdit_5->setValidator(new QDoubleValidator(this));
    ui->lineEdit_6->setValidator(new QDoubleValidator(this));
    connect(ui->lineEdit, SIGNAL(textChanged(QString)), this, SLOT(bmprange()));
    connect(ui->lineEdit_2, SIGNAL(textChanged(QString)), this, SLOT(bmprange()));
    connect(ui->lineEdit_3, SIGNAL(textChanged(QString)), this, SLOT(bmprange()));
    connect(ui->lineEdit_4, SIGNAL(textChanged(QString)), this, SLOT(bmprange()));
    connect(ui->lineEdit_5, SIGNAL(textChanged(QString)), this, SLOT(bmprange()));
    connect(ui->lineEdit_6, SIGNAL(textChanged(QString)), this, SLOT(bmprange()));
}

Dialog::~Dialog()
{
    delete ui;
}

void Dialog::changeEvent(QEvent *e)
{
    QDialog::changeEvent(e);
    switch (e->type()) {
    case QEvent::LanguageChange:
        ui->retranslateUi(this);
        break;
    default:
        break;
    }
}

how can i get bmp, xMax, … to use in mainwindow

  • 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-06-10T23:58:17+00:00Added an answer on June 10, 2026 at 11:58 pm

    I don’t speak C++, so sorry for the lack of details. Here’s what I’d do:

    • Catch the closeEvent that you should have when you close your dialog. If your dialog has a OK button, you can use its clicked signal.
    • Connect it to a particular slot whose functions are (1) to retrieve the texts of all your dialog’s QLineEdit in a single object (a QStringList, for example) and (2) to actually close your dialog.
    • Store the content of this QStringList as an attribute of your main window, or as an independent object you can retrieve from your main window.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a QDialog which I open like this: void MyModule::openDialog() { this->dialog->open(); printf(Hello
I have a problem, I'm calling my QDialog like this in the main(): app.setQuitOnLastWindowClosed(true);
i have classes like this class A : public QDialog { A(QWidget *parent); static
I've designed some construction like this: template<class Ui_Class> class Base_Dialog : virtual public QDialog,
How can I put this two statements into one singel statement. They work something
This has happened for every QDialog I pop that fires from either a mouseReleaseEvent
I have a QDialog that contains several dock widgets and one QGraphicsView. The widget
In GNOME 3 when displaying any QDialog it appears that it can't be moved
I'm searching for something like the finished-signal from QDialog , only for QWidget .
I have a qdialog, with a buttonbox at the bottom; Why isn't this slot

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.