void DockingController::showEvent(QShowEvent *event)
{
- menu->setChecked(true);
+ if (menu != NULL) {
+ menu->setChecked(true);
+ }
}
void DockingController::closeEvent(QCloseEvent *event) {
- menu->setChecked(false);
+ if (menu != NULL) {
+ menu->setChecked(false);
+ }
MainWindow *win = ((MainWindow *)this->parent());
win->getUIState()->conState.dockingCon = NULL;
rubberBand->hide();
}
+ /* toggle */
MainWindow *win = ((MainWindow *)this->parent());
win->getUIState()->conState.recentlyFloatPos = event->globalPos() - eventPos;
- win->openController(win->getUIState()->conState.conFormIndex, false);
- grabPos = QPoint(-1, -1);
+ win->openController(win->getUIState()->conState.conFormIndex, false);
+ return;
}
}
void FloatingController::showEvent(QShowEvent *event)
{
- menu->setChecked(true);
+ if (menu != NULL) {
+ menu->setChecked(true);
+ }
+
setRegion(conForm->conImg[ControllerForm::normal]);
}
void FloatingController::closeEvent(QCloseEvent *event) {
- menu->setChecked(false);
+ if (menu != NULL) {
+ menu->setChecked(false);
+ }
MainWindow *win = ((MainWindow *)this->parent());
win->getUIState()->conState.floatingCon = NULL;
#include "mainwindow.h"
#include "skinkeyitem.h"
+#define DOCKABLE_AREA_WIDTH 30
+
FloatingConView::FloatingConView(ControllerForm *conForm, QGraphicsScene *scene, QWidget *parent) :
QGraphicsView(scene, parent)
{
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setAlignment(Qt::AlignLeft | Qt::AlignTop);
- winPos = QPoint(-1, -1);
+ conPos = QPoint(-1, -1);
grabPos = QPoint(-1, -1);
createItems(conForm);
void FloatingConView::mousePressEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton) {
- QWidget *win = ((QWidget *) this->parent());
+ QWidget *con = ((QWidget *) this->parent());
grabPos = event->globalPos();
- winPos = win->pos();
+ conPos = con->pos();
}
QGraphicsView::mousePressEvent(event);
grabPos = QPoint(-1, -1);
}
+ QWidget *con = ((QWidget *)this->parent());
+ QRect conDockable(
+ con->pos().x() - 1,
+ con->pos().y(),
+ DOCKABLE_AREA_WIDTH,
+ size().height());
+
+ MainWindow *win = ((MainWindow *)con->parent());
+ QRect mainDockable(
+ win->pos().x() + win->uiInfo->getMainSize().width() - 1,
+ win->pos().y(),
+ DOCKABLE_AREA_WIDTH,
+ win->uiInfo->getMainSize().height());
+
+ if (conDockable.intersects(mainDockable) == true) {
+ /* toggle */
+ win->openController(win->getUIState()->conState.conFormIndex, true);
+ return;
+ }
+
QGraphicsView::mouseReleaseEvent(event);
}
void FloatingConView::mouseMoveEvent(QMouseEvent *event)
{
- QWidget *win = ((QWidget *)this->parent());
+ QWidget *con = ((QWidget *)this->parent());
if (grabPos != QPoint(-1, -1)) {
- win->move(winPos + (event->globalPos() - grabPos));
+ con->move(conPos + (event->globalPos() - grabPos));
}
QGraphicsView::mouseMoveEvent(event);
void mouseMoveEvent(QMouseEvent *event);
QPoint grabPos;
- QPoint winPos;
+ QPoint conPos;
private:
void createItems(ControllerForm *conForm);
return;
}
+ QAction *action = NULL;
+ if (popupMenu != NULL) {
+ action = (QAction *)popupMenu->getControllerMapper()->mapping(index);
+ }
+
/* create */
if (docking == true) {
- QAction *action = (QAction *)popupMenu->getControllerMapper()->mapping(index);
conScene = new QGraphicsScene(this);
conScene->setBackgroundBrush(Qt::black);
getUIState()->conState.dockingCon =
new DockingController(conForm, conScene, action, this);
} else {
- QAction *action = (QAction *)popupMenu->getControllerMapper()->mapping(index);
getUIState()->conState.floatingCon =
new FloatingController(conForm, action, this);
}