Results 1 to 20 of 24

Thread: Problems Qt Widgets applications and MySql

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2014
    Posts
    21
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    1

    Default Problems Qt Widgets applications and MySql

    This is just a part of the program. I don't understand why doesn't it throws the error
    Qt Code:
    1. 'mojabaza' was not declared in this scope
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. MainWindow::MainWindow(QWidget *parent) :
    2. QMainWindow(parent),
    3. ui(new Ui::MainWindow)
    4. {
    5. ui->setupUi(this);
    6.  
    7. mojabaza=QSqlDatabase::addDatabase("QSQLITE");
    8. mojabaza.setDatabaseName(pot);
    9. QFileInfo preveri (pot);
    10. if (preveri.isFile())
    11. {if (mojabaza.open()) ui->status->setText("[+]Povezava z bazo je uspela!");
    12. }
    13. else
    14. ui->status->setText("[!]Povezava z bazo NI uspela!");
    15. this->model1=new QSqlQueryModel();
    16.  
    17. }
    18.  
    19. MainWindow::~MainWindow()
    20. {
    21. delete ui;
    22. mojabaza.close(); ///?? should throw the error here
    23. }
    To copy to clipboard, switch view to plain text mode 

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

    Default Re: Problems Qt Widgets applications and MySql

    Why do you expect this to trigger an error in the destructor when the constructor does not?
    It is either a class member, so accessible from all methods of the class, or it is not, in which case it is undeclared everywhere.

    Cheers,
    _

Similar Threads

  1. Problems with QODBC and MySQL
    By crazymonkey in forum Qt Programming
    Replies: 0
    Last Post: 25th April 2011, 13:34
  2. Problems running applications .exe
    By croussou in forum Installation and Deployment
    Replies: 8
    Last Post: 25th March 2011, 19:07
  3. Problems with MySQL on Ubuntu
    By neoclaw in forum Qt Programming
    Replies: 3
    Last Post: 21st June 2010, 03:26
  4. Qwt - Qt Widgets for Technical Applications
    By gandalf in forum Newbie
    Replies: 6
    Last Post: 5th May 2010, 16:09
  5. Problems with Qt 4.3.4 and MySql
    By Headhunter_X in forum Installation and Deployment
    Replies: 9
    Last Post: 19th March 2008, 07:17

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
  •  
Qt is a trademark of The Qt Company.