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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:26:32+00:00 2026-05-31T09:26:32+00:00

I am a student programmer using Qt to build a reader Table for my

  • 0

I am a student programmer using Qt to build a reader Table for my company. This reader is both an editor and converter. It reads in a .i file allows table editing of a text document and then puts out a .scf file which is essentially a separated value file stacked under a legend built with headers. I digress… Basically the file format imported is really hard to scan and read in(mostly impossible) so what I’d like to is modify the open file preBuilt QFileDialog to include an additional drop down when older file types are selected to declare their template headers.

When the user selects .i extension files(option 2 file type) I would like to enable an additional drop down menu to allow the user to select which type of .i file it is(template selected). This way I don’t have to deal with god knows how many hours trying to figure out a way to index all the headers into the table for each different type. Currently my importFile function calls the dialog using this:

QString fileLocation = QFileDialog::getOpenFileName(this,("Open File"), "", ("Simulation Configuration File(*.scf);;Input Files(*.prp *.sze *.i *.I *.tab *.inp *.tbl)")); //launches File Selector

I have been referencing QFileDialog Documentation to try and find a solution to what I need but have had no avail. Thanks for reading my post and thanks in advance for any direction you can give on this.

UPDATE MAR 16 2012;
First I’d like to give thanks to Masci for his initial support in this matter. Below is the connect statement that I have along with the error I receive.

//Declared data type
    QFileDialog openFile;
    QComboBox comboBoxTemplateSelector;
    connect(openFile, SIGNAL(currentChanged(const &QString)), this, SLOT(checkTemplateSelected()));
    openFile.layout()->addWidget(comboBoxTemplateSelector);

compile errors

I also noticed that it didn’t like the way I added the QComboBox to the modified dialog’s layout(which is the second error). I really hope that I’m just doing something dumb here and its an easy task to overcome.

In response to tmpearce’s comment heres my header code;

#include <QWidget>
namespace Ui {
class ReaderTable;
}
class ReaderTable : public QWidget
{
    Q_OBJECT
public:
    explicit ReaderTable(QWidget *parent = 0);
    ~ReaderTable();
public slots:
    void checkTemplateSelected();
    void importFile();
    void saveFile();
private:
    Ui::ReaderTable *ui;
};

Thanks for reading and thanks in advance for any contributions to this challenge!

  • 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-31T09:26:34+00:00Added an answer on May 31, 2026 at 9:26 am

    Instance a QFileDialog (do not call getOpenFileName static method), access its layout and add a disabled QComboBox to it.

    // mydialog_ and cb_ could be private fields inside MyClass
    mydialog_ = new QFileDialog;
    cb_ = new QComboBox;
    cb_->setEnabled(false);
    connect(mydialog, SIGNAL(currentChanged(const QString&)), this, SLOT(checkFilter(const QString&)));
    mydialog_->layout()->addWidget(cb_);
    
    if (mydialog_->exec() == QDialog::Accepted) {
        QString selectedFile = mydialog_->selectedFiles()[0];
        QString cbSelection = cb_->currentText();
    }
    

    the slot would be something like:

    void MyClass::checkFilter(const QString& filter) 
    {
      cb_->setEnabled(filter == "what_you_want");
    }
    

    returning from the dialog exec(), you could retrieve selected file and cb_ current selection.
    Notice you could add something more complex than a simple QComboBox at the bottom of the dialog, taking care of gui cosmetics.

    Actually I don’t like very much this approach (but that was what you asked for :-). I would make a simple dialog like this:

    enter image description here

    and enable the combo only if the selected file meets your criteria. The "browse" button could call getOpenFileMethod static method in QFileDialog.

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

Sidebar

Related Questions

I am a student programmer using Qt to build a GUI for work. I
I am currently a student programmer using Qt to build a GUI inteface at
I'm a student programmer and I am using Qt to build some GUI applications
I am a student programmer and I am using Qt to build a GUI
Im a student programmer and Im using Qt to build a GUI for one
I am a student programmer using Qt to build a GUI interface fro my
I'm a student programmer and I am using Qt to build a GUI for
I'm a student programmer and I am using Qt to build a GUI application.
I am a student programmer using Qt to develop a GUI application. I am
I am student programmer and I am using Qt to develop a GUI interface

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.