Commit 5582367f authored by NICLAUSSE Nicolas's avatar NICLAUSSE Nicolas
Browse files

Merge branch 'develop' of github.com:d-tk/dtk into develop

parents 0082d927 d3944424
class dtkViewLayout : public QFrame {
%TypeHeaderCode
#include <dtkWidgets/dtkViewLayout.h>
#include <dtkWidgets/dtkViewLayoutItem.h>
#include <dtkWidgets/dtkViewWidget.h>
#include <QtWidgets/QFrame>
%End
public:
dtkViewLayout(QWidget *parent = 0);
public:
dtkViewLayoutItem *root();
dtkViewLayoutItem *current();
public:
void setCurrent(dtkViewLayoutItem *item);
signals:
void focused(dtkViewWidget *view);
void unfocused(dtkViewWidget *view);
public slots:
void clear();
};
class dtkViewLayoutItem : public QFrame {
%TypeHeaderCode
#include <dtkWidgets/dtkViewLayout.h>
#include <dtkWidgets/dtkViewLayoutItem.h>
#include <QtWidgets/QFrame>
%End
public:
dtkViewLayoutItem(dtkViewLayoutItem *parent = 0);
public:
dtkViewWidget *view();
public:
dtkViewLayoutItem *parent();
dtkViewLayoutItem *first();
dtkViewLayoutItem *second();
public:
void setOrientation(Qt::Orientation orientation);
void setSizes(QList<int> sizes);
public:
int canvasHeight();
int footerHeight();
int handleHeight();
int handleWidth();
public:
dtkViewLayout *layout();
};
......@@ -19,4 +19,6 @@ public slots:
void onViewFocused(dtkViewWidget *);
void onViewUnfocused(dtkViewWidget *);
public:
dtkViewLayout *layout();
};
......@@ -2,6 +2,8 @@
%Import QtWidgets/QtWidgetsmod.sip
%Include dtkViewController.sip
%Include dtkViewLayout.sip
%Include dtkViewLayoutItem.sip
%Include dtkViewManager.sip
%Include dtkViewWidget.sip
%Include dtkViewController.sip
......@@ -124,7 +124,9 @@ if(DTK_BUILD_WRAPPERS)
set(${PROJECT_NAME}_SIP_WRAPPERS
sip${PROJECT_NAME}dtkViewController.cpp
sip${PROJECT_NAME}dtkViewManager.cpp
sip${PROJECT_NAME}dtkViewWidget.cpp)
sip${PROJECT_NAME}dtkViewWidget.cpp
sip${PROJECT_NAME}dtkViewLayout.cpp
sip${PROJECT_NAME}dtkViewLayoutItem.cpp)
dtk_wrap_sip(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtkWidgets ${CMAKE_SOURCE_DIR}/sip/dtkWidgets/dtkWidgetsmod.sip "${${PROJECT_NAME}_SIP_WRAPPERS}" "${${PROJECT_NAME}_WRAP_DEPENDS}")
endif(SIP_FOUND)
......
......@@ -211,6 +211,7 @@ dtkViewLayoutItem::dtkViewLayoutItem(dtkViewLayoutItem *parent) : QFrame(parent)
d->proxy = new dtkViewLayoutItemProxy(this);
d->splitter = new QSplitter(this);
d->splitter->setHandleWidth(2);
d->splitter->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
d->splitter->addWidget(d->proxy);
......@@ -255,6 +256,8 @@ dtkViewLayoutItem::dtkViewLayoutItem(dtkViewLayoutItem *parent) : QFrame(parent)
d->vertc->setEnabled(false);
d->horzt->setEnabled(false);
d->maxmz->setEnabled(false);
this->setFocusPolicy(Qt::ClickFocus);
}
dtkViewLayoutItem::~dtkViewLayoutItem(void)
......@@ -643,10 +646,16 @@ void dtkViewLayoutItem::dropEvent(QDropEvent *event)
d->proxy->setView(view);
}
void dtkViewLayoutItem::mousePressEvent(QMouseEvent *event)
{
Q_UNUSED(event);
this->onFocusedIn();
}
void dtkViewLayoutItem::notify(dtkViewWidget *view)
{
if (d->root == this)
emit focused(view);
emit focused(view);
}
//
......
......@@ -118,6 +118,7 @@ protected:
void dragMoveEvent(QDragMoveEvent *);
void dragLeaveEvent(QDragLeaveEvent *);
void dropEvent(QDropEvent *);
void mousePressEvent(QMouseEvent *);
private:
void notify(dtkViewWidget *view);
......
......@@ -91,5 +91,10 @@ void dtkViewManager::onViewUnfocused(dtkViewWidget *widget)
d->view_inspector->removeWidget(widget->inspector());
}
dtkViewLayout *dtkViewManager::layout(void)
{
return d->view_layout;
}
//
// dtkViewManager.cpp ends here
......@@ -18,6 +18,7 @@
#include <QtWidgets/QFrame>
class dtkViewLayout;
class dtkViewManagerPrivate;
class dtkViewWidget;
......@@ -26,7 +27,7 @@ class DTKWIDGETS_EXPORT dtkViewManager : public QFrame
Q_OBJECT
public:
dtkViewManager(QWidget *parent = 0);
dtkViewManager(QWidget *parent = 0);
~dtkViewManager(void);
signals:
......@@ -39,6 +40,9 @@ public slots:
void onViewFocused(dtkViewWidget *widget);
void onViewUnfocused(dtkViewWidget *widget);
public:
dtkViewLayout *layout(void);
private:
dtkViewManagerPrivate *d;
};
......
......@@ -40,5 +40,12 @@ QWidget *dtkViewWidget::inspector(void)
return NULL;
}
void dtkViewWidget::mousePressEvent(QMouseEvent *event)
{
dtkViewWidget::mousePressEvent(event);
emit focused();
}
//
// dtkViewWidget.cpp ends here
......@@ -34,6 +34,9 @@ public:
virtual QWidget *widget(void);
virtual QWidget *inspector(void);
protected:
void mousePressEvent(QMouseEvent *);
private:
class dtkViewWidgetPrivate *d;
};
......
......@@ -234,8 +234,8 @@ void dtkWidgetsTagCloudListLightDelegate::paint(QPainter *painter, const QStyleO
int t = option.rect.top();
int r = option.rect.right();
QRect name_rect = QRect(m, t + 1 * m, w - 2 * m, h1);
QRect desc_rect = QRect(m, t + 2 * m + h1, w - 6 * m, h2);
QRect name_rect = QRect(m, t + 1 * m, w - 2 * m, h1);
QRect desc_rect = QRect(m, t + 2 * m + h1, w - 6 * m, h2);
QRect tags_rect = QRect(m, t + 3 * m + h1 + h2, w - 2 * m, h3);
QFontMetrics metrics = QFontMetrics(painter->font());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment