简体   繁体   中英

What's the difference between two QHeaderView signals?

On Qt doc website in QHeaderView class i found two signals with similar descriptions:

void QHeaderView::sectionDoubleClicked(int logicalIndex)

and

void QHeaderView::sectionHandleDoubleClicked(int logicalIndex)

what's the difference between the two of these? When should I use the first, and when the other?

Although the documentation strings are exactly the same,

void QHeaderView::sectionDoubleClicked(int logicalIndex) This signal is emitted when a section is double-clicked. The section's logical index is specified by logicalIndex.

[signal]void QHeaderView::sectionHandleDoubleClicked(int logicalIndex) This signal is emitted when a section is double-clicked. The section's logical index is specified by logicalIndex.

The signals are emitted in different cases. From KDE's copy of Qt5 ,

void QHeaderView::mouseDoubleClickEvent(QMouseEvent *e)
{
...
    int handle = d->sectionHandleAt(pos);
    if (handle > -1 && sectionResizeMode(handle) == Interactive) {
        emit sectionHandleDoubleClicked(handle);
...
    } else {
        emit sectionDoubleClicked(logicalIndexAt(e->position().toPoint()));
    }
}

The documentation doesn't make it particularly clear, though, when "handles" might be present and when they aren't. At a guess, if your sections are resizable you may get a handle -- for resizing -- and then you can (double) click on either the handle or the section-body.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM