Results 1 to 3 of 3

Thread: IDE-like interface

  1. #1
    Join Date
    Aug 2014
    Posts
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default IDE-like interface

    Greetings, I'm a bit of a hobbyist programmer in a few languages, and am now finally stepping up to real application developement.
    Was giving Qt a shot and I must say its very good for rapid GUI building on linux.

    What I'm working on is pretty analogous to an IDE, in that you chose a 'project file' which is read in and sets up the project paths and such.

    I'm having issue with a portion of it, in that I can't figure out how to pass information from the project file into a subwindow of the application;
    Current code:
    Qt Code:
    1. void MainWindow::file_open_project()
    2. {
    3. QString projectFile = QFileDialog::getOpenFileName(
    4. this, tr("Open Project"),
    5. QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation),
    6. tr("Project files (*.proj)"));
    7. if(!projectFile.isEmpty())
    8. {
    9. load_project(projectFile);
    10. }
    11. }
    12.  
    13. void MainWindow::load_project(QString projectFile)
    14. {
    15. QFileInfo project(projectFile);
    16. QString projectPath = project.absolutePath();
    17. QSettings *projectSettings = new QSettings(projectPath+"/Project", QSettings::IniFormat, this);
    18. this->archiveFile->append(projectSettings->value("Archive").toString());
    19. }
    20.  
    21. void MainWindow::archiveAction()
    22. {
    23. ArchiveEditor *archiveEditor = new ArchiveEditor(this, &archiveFile);
    24. archiveEditor->setAttribute(Qt::WA_DeleteOnClose);
    25. archiveEditor->setAttribute(Qt::WA_ShowModal);
    26. archiveEditor->show();
    27. }
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. ArchiveEditor::ArchiveEditor(QWidget *parent, QString *file)
    2. :QWidget(parent, Qt::Window)
    3. {
    4. setWindowTitle(tr("Archive Editor"));
    5.  
    6. loadScriptArchive(file);
    7. }
    8.  
    9. void ArchiveEditor::loadArchive(const QString &file)
    10. {
    11. QFile archiveFile = QFile(file);
    12. if (!archiveFile.open(QFile::ReadOnly))
    13. {
    14. QMessageBox::critical(this,
    15. tr("File read error"), tr("Cannot open file: ") + file);
    16. return;
    17. }
    18. }
    To copy to clipboard, switch view to plain text mode 

    ArchiveEditor obviously doesn't do much atm, I'm just trying to figure out how to pass something from the Project.ini file into a subwindow to tell it which archive to load.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: IDE-like interface

    Aside from this not compliing due to trying to copy QFile, what is your actual question?

    This looks more or less OK, though I wouldn't pass the QString as a pointer (it is a value class and can easily be copied) and making a dialog modal is a lot easier by just calling QDialog::exec(), i.e. not need to set the modality flag.

    Cheers,
    _

  3. #3
    Join Date
    Aug 2014
    Posts
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: IDE-like interface

    Heh, I feel kinda dumb now; problem was I was parsing the settings file wrong; it had one of those ini [SubSections] and was not taking that into account XD

Similar Threads

  1. Replies: 1
    Last Post: 12th August 2012, 17:37
  2. problem with interface Class - Error:undefined interface
    By k.qasempour in forum Qt Programming
    Replies: 4
    Last Post: 12th August 2012, 02:11
  3. qt usb interface
    By anan1975 in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 3rd June 2012, 12:05
  4. C++ Interface ..???
    By joseph in forum General Programming
    Replies: 3
    Last Post: 28th May 2008, 09:27
  5. how to do interface for gdb
    By misiak in forum Qt Programming
    Replies: 2
    Last Post: 13th November 2006, 21:19

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.