Results 1 to 5 of 5

Thread: db populates model based QTreeView, rowclicked populates QTextBrowser but...

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: db populates model based QTreeView, rowclicked populates QTextBrowser but...

    I suggest you read the error messages again. The compiler is not issuing them out of spite: ui and model are not valid where you are trying to use them.

    If your code actually looks like:
    Qt Code:
    1. void rowClicked(const QModelIndex& ...) {
    2. // E:\Bird\splash1\mainwindow.cpp:-1: In function 'void rowClicked(const QModelIndex&)':
    3. // E:\Bird\splash1\mainwindow.cpp:181: error: 'model' was not declared in this scope
    4. // E:\Bird\splash1\mainwindow.cpp:186: error: 'ui' was not declared in this scope
    5. // E:\Bird\splash1\mainwindow.cpp:181: warning: unused variable 'id' [-Wunused-variable]
    6. ...
    7. }
    To copy to clipboard, switch view to plain text mode 
    then the issue is that rowClicked() is a free function and not part of the MainWindow class (i.e. void MainWindow::rowClicked()).

  2. The following user says thank you to ChrisW67 for this useful post:

    eutectoid (26th June 2013)

  3. #2
    Join Date
    Jun 2013
    Posts
    3
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: db populates model based QTreeView, rowclicked populates QTextBrowser but...

    Hi,
    Thank you for your time and suggestions.
    I did read the error messages and googled as to what they meant but as a newbie, I did not understand.
    This part of the program works now and I won't make this mistake a second time.
    Thanks once again for your input

Similar Threads

  1. Replies: 7
    Last Post: 8th February 2013, 23:26
  2. From item based widgets to model/view
    By timom in forum Qt Programming
    Replies: 2
    Last Post: 22nd September 2011, 07:35
  3. Qcombobox and model/item based question
    By yaguis in forum Newbie
    Replies: 5
    Last Post: 7th June 2010, 01:22
  4. QComboBox (model based) - provide an empty entry
    By antarctic in forum Qt Programming
    Replies: 0
    Last Post: 21st October 2009, 18:45
  5. Replies: 21
    Last Post: 5th January 2008, 15:44

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.