Results 1 to 5 of 5

Thread: Connect 2 QScrollArea

  1. #1
    Join Date
    May 2014
    Posts
    3
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Connect 2 QScrollArea

    Hi,
    I have a QScrollArea "scrollMain" and I want to use a QScrollArea "scrollVertical" and a QScrollArea "scrollHorizontal" to control "scrollMain". You understand that "scrollVertical" and "scrollHorizontal" will contain headers for datas in "scrollMain".
    I tried :
    Qt Code:
    1. connect(ScrollArea1->verticalScrollBar(),valueChanged(int),ScrollArea2->verticalScrollBar(),setValue(int));
    To copy to clipboard, switch view to plain text mode 
    but I got "undefined functions" messages.
    I tried to create my own functions without success.
    It seems "value" parameter from verticalScrollBar() and horizontalScrollBar() are unreachable.

    Do you have an issue?
    Thanks

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,540
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Connect 2 QScrollArea

    You have forgotten the words SIGNAL and SLOT
    Qt Code:
    1. connect(ScrollArea1->verticalScrollBar(),SIGNAL(valueChanged(int)),ScrollArea2->verticalScrollBar(),SLOT(setValue(int)));
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    May 2014
    Posts
    3
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Connect 2 QScrollArea

    no matching function for call to 'Timeline::connect(QScrollBar*, const char*, QScrollBar*, const char*)'
    ui->scrollMain->verticalScrollBar(),SLOT(setValue(int)));

    This is the complete line :
    Qt Code:
    1. connect(ui->scrollVertical->verticalScrollBar(),SIGNAL(valueChanged(int)),
    2. ui->scrollMain->verticalScrollBar(),SLOT(setValue(int)));
    To copy to clipboard, switch view to plain text mode 
    Last edited by sev75; 31st May 2014 at 13:28.

  4. #4
    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: Connect 2 QScrollArea

    Do you have the include for QScrollBar?

    Cheers,
    _

  5. The following user says thank you to anda_skoa for this useful post:

    sev75 (31st May 2014)

  6. #5
    Join Date
    May 2014
    Posts
    3
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Connect 2 QScrollArea

    Indeed, I forgot the include. Thanks very much

Similar Threads

  1. Replies: 5
    Last Post: 27th January 2014, 22:22
  2. Replies: 2
    Last Post: 9th May 2011, 10:38
  3. Replies: 16
    Last Post: 16th February 2010, 13:17
  4. Replies: 2
    Last Post: 10th March 2008, 20:16
  5. Replies: 4
    Last Post: 10th November 2006, 15:38

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.