added Alt+LeftClick to move splits around
This commit is contained in:
@@ -582,6 +582,13 @@ void ChannelView::leaveEvent(QEvent *)
|
||||
|
||||
void ChannelView::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->modifiers() & (Qt::AltModifier | Qt::ControlModifier)) {
|
||||
this->unsetCursor();
|
||||
|
||||
event->ignore();
|
||||
return;
|
||||
}
|
||||
|
||||
if (singletons::SettingManager::getInstance().pauseChatHover.getValue()) {
|
||||
this->pause(300);
|
||||
}
|
||||
@@ -639,6 +646,13 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event)
|
||||
|
||||
void ChannelView::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->modifiers() & (Qt::AltModifier | Qt::ControlModifier)) {
|
||||
this->unsetCursor();
|
||||
|
||||
event->ignore();
|
||||
return;
|
||||
}
|
||||
|
||||
if (singletons::SettingManager::getInstance().linksDoubleClickOnly.getValue()) {
|
||||
this->pause(200);
|
||||
}
|
||||
@@ -689,6 +703,13 @@ void ChannelView::mousePressEvent(QMouseEvent *event)
|
||||
|
||||
void ChannelView::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->modifiers() & (Qt::AltModifier | Qt::ControlModifier)) {
|
||||
this->unsetCursor();
|
||||
|
||||
event->ignore();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this->isMouseDown) {
|
||||
// We didn't grab the mouse press, so we shouldn't be handling the mouse
|
||||
// release
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//#include "widgets/helper/notebooktab.hpp"
|
||||
#include "widgets/helper/notebooktab.hpp"
|
||||
#include "common.hpp"
|
||||
#include "debug/log.hpp"
|
||||
#include "singletons/settingsmanager.hpp"
|
||||
@@ -167,6 +167,7 @@ void NotebookTab::paintEvent(QPaintEvent *)
|
||||
|
||||
// select the right tab colors
|
||||
singletons::ThemeManager::TabColors colors;
|
||||
singletons::ThemeManager::TabColors regular = this->themeManager.tabs.regular;
|
||||
|
||||
if (this->selected) {
|
||||
colors = this->themeManager.tabs.selected;
|
||||
@@ -181,11 +182,14 @@ void NotebookTab::paintEvent(QPaintEvent *)
|
||||
bool windowFocused = this->window() == QApplication::activeWindow();
|
||||
// || SettingsDialog::getHandle() == QApplication::activeWindow();
|
||||
|
||||
painter.fillRect(rect(), this->mouseOver ? regular.backgrounds.hover
|
||||
: (windowFocused ? regular.backgrounds.regular
|
||||
: regular.backgrounds.unfocused));
|
||||
|
||||
// fill the tab background
|
||||
painter.fillRect(rect(),
|
||||
this->mouseOver ? colors.backgrounds.hover
|
||||
: (windowFocused ? colors.backgrounds.regular
|
||||
: colors.backgrounds.unfocused));
|
||||
painter.fillRect(rect(), this->mouseOver ? colors.backgrounds.hover
|
||||
: (windowFocused ? colors.backgrounds.regular
|
||||
: colors.backgrounds.unfocused));
|
||||
|
||||
// set the pen color
|
||||
painter.setPen(colors.text);
|
||||
|
||||
@@ -184,32 +184,8 @@ void SplitHeader::mouseMoveEvent(QMouseEvent *event)
|
||||
if (this->dragging) {
|
||||
if (std::abs(this->dragStart.x() - event->pos().x()) > 12 ||
|
||||
std::abs(this->dragStart.y() - event->pos().y()) > 12) {
|
||||
auto page = static_cast<SplitContainer *>(this->split->parentWidget());
|
||||
|
||||
if (page != nullptr) {
|
||||
SplitContainer::isDraggingSplit = true;
|
||||
SplitContainer::draggingSplit = this->split;
|
||||
|
||||
auto originalLocation = page->removeFromLayout(this->split);
|
||||
|
||||
// page->update();
|
||||
|
||||
QDrag *drag = new QDrag(this->split);
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
|
||||
mimeData->setData("chatterino/split", "xD");
|
||||
|
||||
drag->setMimeData(mimeData);
|
||||
|
||||
Qt::DropAction dropAction = drag->exec(Qt::MoveAction);
|
||||
|
||||
if (dropAction == Qt::IgnoreAction) {
|
||||
page->addToLayout(this->split, originalLocation);
|
||||
}
|
||||
|
||||
SplitContainer::isDraggingSplit = false;
|
||||
this->dragging = false;
|
||||
}
|
||||
this->split->drag();
|
||||
this->dragging = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user