mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Factor out useful code into a function
This code will be shared by TabWorkArea::mouseReleaseEvent, which will be implemented shortly.
This commit is contained in:
parent
07be240ebe
commit
b236450e61
@ -1628,6 +1628,15 @@ void TabWorkArea::paintEvent(QPaintEvent * event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool TabWorkArea::posIsTab(QPoint position)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < count(); ++i)
|
||||||
|
if (tabBar()->tabRect(i).contains(position))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void TabWorkArea::mouseDoubleClickEvent(QMouseEvent * event)
|
void TabWorkArea::mouseDoubleClickEvent(QMouseEvent * event)
|
||||||
{
|
{
|
||||||
if (event->button() != Qt::LeftButton)
|
if (event->button() != Qt::LeftButton)
|
||||||
@ -1640,9 +1649,8 @@ void TabWorkArea::mouseDoubleClickEvent(QMouseEvent * event)
|
|||||||
// leave this code for now. (skostysh, 2016-07-21)
|
// leave this code for now. (skostysh, 2016-07-21)
|
||||||
//
|
//
|
||||||
// return early if double click on existing tabs
|
// return early if double click on existing tabs
|
||||||
for (int i = 0; i < count(); ++i)
|
if (posIsTab(event->pos()))
|
||||||
if (tabBar()->tabRect(i).contains(event->pos()))
|
return;
|
||||||
return;
|
|
||||||
|
|
||||||
dispatch(FuncRequest(LFUN_BUFFER_NEW));
|
dispatch(FuncRequest(LFUN_BUFFER_NEW));
|
||||||
}
|
}
|
||||||
|
@ -234,7 +234,9 @@ private Q_SLOTS:
|
|||||||
void mouseDoubleClickEvent(QMouseEvent * event);
|
void mouseDoubleClickEvent(QMouseEvent * event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
///
|
/// true if position is a tab (rather than the blank space in tab bar)
|
||||||
|
bool posIsTab(QPoint position);
|
||||||
|
|
||||||
int clicked_tab_;
|
int clicked_tab_;
|
||||||
///
|
///
|
||||||
QToolButton * closeBufferButton;
|
QToolButton * closeBufferButton;
|
||||||
|
Loading…
Reference in New Issue
Block a user