Improved handling and display of border drop overlays. Now border drop overlay items are visible as soon as a floating widget enters container widget area, some refactoring to improve code quality
This commit is contained in:
@@ -60,12 +60,8 @@ enum DropArea
|
||||
LeftDropArea = 8,
|
||||
CenterDropArea = 16,
|
||||
|
||||
TopBorderDropArea = 32,
|
||||
RightBorderDropArea = 64,
|
||||
BottomBorderDropArea = 128,
|
||||
LeftBorderDropArea = 256,
|
||||
|
||||
AllAreas = TopDropArea | RightDropArea | BottomDropArea | LeftDropArea | CenterDropArea
|
||||
OuterAreas = TopDropArea | RightDropArea | BottomDropArea | LeftDropArea,
|
||||
AllAreas = OuterAreas | CenterDropArea
|
||||
};
|
||||
Q_DECLARE_FLAGS(DropAreas, DropArea)
|
||||
|
||||
|
||||
@@ -141,11 +141,15 @@ private:
|
||||
|
||||
void moveFloatingWidget(const QPoint& TargetPos);
|
||||
FloatingWidget* startFloating(SectionWidget* sectionwidget, int ContentUid, const QPoint& TargetPos);
|
||||
void hideContainerOverlay();
|
||||
SectionWidget* insertNewSectionWidget(const InternalContentData& data,
|
||||
SectionWidget* targetSection, SectionWidget* ret, Qt::Orientation Orientation, int InsertIndexOffset);
|
||||
|
||||
private slots:
|
||||
void onActiveTabChanged();
|
||||
void onActionToggleSectionContentVisibility(bool visible);
|
||||
|
||||
|
||||
signals:
|
||||
void orientationChanged();
|
||||
|
||||
|
||||
@@ -27,6 +27,9 @@ class FloatingWidget;
|
||||
class HiddenSectionItem;
|
||||
|
||||
|
||||
/**
|
||||
* Container widget private data
|
||||
*/
|
||||
struct ContainerWidgetPrivate
|
||||
{
|
||||
// Elements inside container.
|
||||
@@ -42,15 +45,16 @@ struct ContainerWidgetPrivate
|
||||
|
||||
|
||||
// Layout stuff
|
||||
QGridLayout* mainLayout = nullptr;
|
||||
QGridLayout* MainLayout = nullptr;
|
||||
Qt::Orientation orientation = Qt::Horizontal;
|
||||
QPointer<QSplitter> splitter; // $mfreiholz: I'd like to remove this variable entirely,
|
||||
// because it changes during user interaction anyway.
|
||||
|
||||
// Drop overlay stuff.
|
||||
QPointer<DropOverlay> dropOverlay;
|
||||
QWidget* LeftBorderDropArea;
|
||||
};
|
||||
QPointer<DropOverlay> SectionDropOverlay;
|
||||
QPointer<DropOverlay> ContainerDropOverlay;
|
||||
//QWidget* LeftBorderDropArea;
|
||||
}; // struct ContainerWidgetPrivate
|
||||
} // namespace ads
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,13 @@ class ADS_EXPORT_API DropOverlay : public QFrame
|
||||
friend class DropOverlayCross;
|
||||
|
||||
public:
|
||||
DropOverlay(QWidget* parent);
|
||||
enum eMode
|
||||
{
|
||||
ModeSectionOverlay,
|
||||
ModeContainerOverlay
|
||||
};
|
||||
|
||||
DropOverlay(QWidget* parent, eMode Mode = ModeSectionOverlay);
|
||||
virtual ~DropOverlay();
|
||||
|
||||
void setAllowedAreas(DropAreas areas);
|
||||
@@ -67,19 +73,22 @@ public:
|
||||
DropOverlayCross(DropOverlay* overlay);
|
||||
virtual ~DropOverlayCross();
|
||||
|
||||
void setAreaWidgets(const QHash<DropArea, QWidget*>& widgets);
|
||||
DropArea cursorLocation() const;
|
||||
void setupOverlayCross(DropOverlay::eMode Mode);
|
||||
|
||||
protected:
|
||||
virtual void showEvent(QShowEvent* e);
|
||||
void setAreaWidgets(const QHash<DropArea, QWidget*>& widgets);
|
||||
|
||||
private:
|
||||
void reset();
|
||||
QPoint areaGridPosition(const DropArea area);
|
||||
|
||||
private:
|
||||
DropOverlay* _overlay;
|
||||
QHash<DropArea, QWidget*> _widgets;
|
||||
QGridLayout* _grid;
|
||||
DropOverlay::eMode m_Mode = DropOverlay::ModeSectionOverlay;
|
||||
DropOverlay* m_DropOverlay;
|
||||
QHash<DropArea, QWidget*> m_DropIndicatorWidgets;
|
||||
QGridLayout* m_GridLayout;
|
||||
};
|
||||
|
||||
ADS_NAMESPACE_END
|
||||
|
||||
Reference in New Issue
Block a user