Results 1 to 3 of 3

Thread: QHeaderView

  1. #1
    Join Date
    May 2009
    Location
    USA
    Posts
    300
    Thanks
    82
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default QHeaderView

    How to reference a QHeaderView from a different function?

    When it is declared like this:

    QHeaderView *header = view->horizontalHeader();

    It works ok, but I can't reference it from another function to save the column positions when the user quits.

    When I try to use this:

    header = new QHeaderView(Horizontal, QWidget *parent = 0);

    It won't compile.

    Any ideas as to how I can do this?

  2. #2
    Join Date
    Dec 2009
    Posts
    19
    Thanks
    2
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QHeaderView

    Well, you can store it as a class member, or pass it to another function as an argument.
    Qt Code:
    1. header = new QHeaderView(Horizontal, QWidget *parent = 0);
    To copy to clipboard, switch view to plain text mode 
    This won't compile unless you have member or local variable "header". Furthermore, "Horizontal" is declared in "Qt" namespace, thus should be accessed via "Qt::Horizontal" (without the quotes), and the second argument to the constructor is.. hm.. well that way it can only be used in constructor declaration (it actually means optional argument with default value equal to 0), so it's definately syntax error.
    Last edited by nateriver; 25th December 2009 at 17:49. Reason: typo

  3. The following user says thank you to nateriver for this useful post:

    waynew (25th December 2009)

  4. #3
    Join Date
    May 2009
    Location
    USA
    Posts
    300
    Thanks
    82
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QHeaderView

    Thanks - I get so focused on what I am trying to make the code do that I forget the basics. Compiles fine.

    Now if I can just get the saveState() QByteArray to save properly in the database all will be well.

Similar Threads

  1. Replies: 2
    Last Post: 16th November 2012, 20:41
  2. Capture mouse event on QHeaderView
    By squidge in forum Qt Programming
    Replies: 10
    Last Post: 10th August 2012, 11:54
  3. QHeaderView -- diagonal headers?
    By vycke in forum Qt Programming
    Replies: 7
    Last Post: 28th April 2008, 23:54
  4. QHeaderView as a banner
    By mclark in forum Qt Programming
    Replies: 1
    Last Post: 21st March 2007, 19:28
  5. Renumbering Row Headers of QHeaderView
    By mclark in forum Newbie
    Replies: 4
    Last Post: 11th September 2006, 15:04

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.