Results 1 to 3 of 3

Thread: QTabWidget problem

  1. #1

    Default QTabWidget problem


    I have a QTabWidget with other stuff that I put together using Designer. Each tab contains some visual elements like QTreeViews, etc. In Designer, I've set the tab position to be South, and the tabs appear at the bottom as they should.

    However, I wanted some custom behavior during drag/drop events, so I subclassed QTabWidget. My problem is in using the tabAt function in QTabBar (namely in calls in the QTabWidget subclass such as tabBar()->tabAt(event->pos())). The function returns -1 (indicating no tab under the cursor) even though the cursor is over a tab, but it will return the proper tab index when the cursor is over where the tab would be if the tab position was North (sorry for the confusing wording).

    In other words, it seems like something is wrong in that it believes the tabs are still in the North position, even though they are in the South position. Any suggestions?

  2. #2
    Join Date
    Jan 2007
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Re: QTabWidget problem

    Hi, can we see some code?

  3. #3

    Default Re: QTabWidget problem

    Qt Code:
    1. void OutputTabWidget::dragMoveEvent(QDragMoveEvent* event)
    2. {
    3. qDebug("tab under mouse is %i", tabBar()->tabAt(event->pos()));
    4. }
    To copy to clipboard, switch view to plain text mode 

    OutputTabWidget is a subclass of QTabWidget. The UI work was done in Designer (if you want me to post the code it generated I can), which would be where the TabPosition is set to South, mouseTracking is set to true, etc.

    The debug output spits out the correct indexes for the tab under the cursor (during the drag) if the tabs are in the North position (if I change it in Designer).

Similar Threads

  1. PyQt QTimer problem { FIXED }
    By WinchellChung in forum Newbie
    Replies: 0
    Last Post: 1st March 2008, 17:50
  2. problem with opengl, zooming, drawpixels, and origin
    By ntp in forum General Programming
    Replies: 0
    Last Post: 22nd February 2008, 22:48
  3. Tricky problem with ARGB widget / UpdateLayeredWindow
    By nooky59 in forum Qt Programming
    Replies: 3
    Last Post: 21st February 2008, 11:35
  4. Grid Layout Problem
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2006, 13:45
  5. fftw problem
    By lordy in forum General Programming
    Replies: 1
    Last Post: 16th March 2006, 22:36

Tags for this Thread


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.