example: Show usage of segmented indicators
This commit is contained in:
@@ -75,6 +75,9 @@ int main(int argc, char **argv)
|
||||
QCommandLineOption maximizeButton("b", QCoreApplication::translate("main", "DockWidgets have maximize/restore buttons instead of float/dock button"));
|
||||
parser.addOption(maximizeButton);
|
||||
|
||||
QCommandLineOption segmentedIndicators("y", QCoreApplication::translate("main", "Use segmented indicators instead of classical"));
|
||||
parser.addOption(segmentedIndicators);
|
||||
|
||||
parser.addPositionalArgument("savedlayout", QCoreApplication::translate("main", "loads the specified json file at startup"));
|
||||
|
||||
#ifdef KDDOCKWIDGETS_SUPPORTS_NESTED_MAINWINDOWS
|
||||
@@ -101,6 +104,9 @@ int main(int argc, char **argv)
|
||||
Config::self().setSeparatorThickness(10);
|
||||
}
|
||||
|
||||
if (parser.isSet(segmentedIndicators))
|
||||
KDDockWidgets::DefaultWidgetFactory::s_dropIndicatorType = KDDockWidgets::DropIndicatorType::Segmented;
|
||||
|
||||
MainWindowOptions options = MainWindowOption_None;
|
||||
#if defined(DOCKS_DEVELOPER_MODE)
|
||||
options = parser.isSet(centralFrame) ? MainWindowOption_HasCentralFrame
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
|
||||
using namespace KDDockWidgets;
|
||||
|
||||
DropIndicatorType DefaultWidgetFactory::s_dropIndicatorType = DropIndicatorType::Classic;
|
||||
|
||||
FrameworkWidgetFactory::~FrameworkWidgetFactory()
|
||||
{
|
||||
}
|
||||
@@ -84,6 +86,13 @@ FloatingWindow *DefaultWidgetFactory::createFloatingWindow(Frame *frame, MainWin
|
||||
|
||||
DropIndicatorOverlayInterface *DefaultWidgetFactory::createDropIndicatorOverlay(DropArea *dropArea) const
|
||||
{
|
||||
switch (s_dropIndicatorType) {
|
||||
case DropIndicatorType::Classic:
|
||||
return new ClassicIndicators(dropArea);
|
||||
case DropIndicatorType::Segmented:
|
||||
return new SegmentedIndicators(dropArea);
|
||||
}
|
||||
|
||||
return new ClassicIndicators(dropArea);
|
||||
}
|
||||
|
||||
|
||||
@@ -142,6 +142,8 @@ public:
|
||||
FloatingWindow *createFloatingWindow(Frame *frame, MainWindowBase *parent = nullptr) const override;
|
||||
DropIndicatorOverlayInterface *createDropIndicatorOverlay(DropArea*) const override;
|
||||
QWidgetOrQuick *createRubberBand(QWidgetOrQuick *parent) const override;
|
||||
|
||||
static DropIndicatorType s_dropIndicatorType;
|
||||
private:
|
||||
Q_DISABLE_COPY(DefaultWidgetFactory)
|
||||
};
|
||||
|
||||
@@ -73,6 +73,11 @@ namespace KDDockWidgets
|
||||
SizePolicy, ///< Uses the item's sizeHint() and sizePolicy()
|
||||
};
|
||||
|
||||
enum class DropIndicatorType {
|
||||
Classic, ///< The default
|
||||
Segmented
|
||||
};
|
||||
|
||||
///@internal
|
||||
inline QString locationStr(Location loc)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user