Remove duplicate DefaultSizeMode enum

It's already in Item_p.h
This commit is contained in:
Sergio Martins
2020-12-27 13:56:58 +00:00
parent d6dea6f426
commit a28e152a37
4 changed files with 15 additions and 18 deletions

View File

@@ -65,15 +65,6 @@ namespace KDDockWidgets
};
Q_DECLARE_FLAGS(RestoreOptions, RestoreOption)
///@brief When a widget is added we need to figure out what's a decent size for it
///This enum specifies the different ways to calculate it
enum class DefaultSizeMode {
ItemSize, ///< Simply uses the Item::size() of the item being added. Actual used size might be smaller if our window isn't big enough.
Fair, ///< Gives an equal relative size as the items that are already in the layout
FairButFloor, ///< Equal to fair, but if the item is smaller than the fair suggestion, then that small size is used.
SizePolicy, ///< Uses the item's sizeHint() and sizePolicy()
};
enum class DropIndicatorType {
Classic, ///< The default
Segmented, ///< Segmented indicators

View File

@@ -136,9 +136,9 @@ void DropArea::addDockWidget(DockWidgetBase *dw, Location location, DockWidgetBa
}
if (option & AddingOption_StartHidden) {
addWidget(dw, location, relativeToFrame, DefaultSizeMode::Fair, option);
addWidget(dw, location, relativeToFrame, Layouting::Item::DefaultSizeMode::Fair, option);
} else {
addWidget(frame, location, relativeToFrame, DefaultSizeMode::Fair, option);
addWidget(frame, location, relativeToFrame, Layouting::Item::DefaultSizeMode::Fair, option);
}
if (hadSingleFloatingFrame && !hasSingleFloatingFrame()) {
@@ -319,13 +319,14 @@ bool DropArea::drop(QWidgetOrQuick *droppedWindow, KDDockWidgets::Location locat
auto frame = Config::self().frameworkWidgetFactory()->createFrame();
frame->addWidget(dock);
addWidget(frame, location, relativeTo, DefaultSizeMode::FairButFloor);
addWidget(frame, location, relativeTo, Layouting::Item::DefaultSizeMode::FairButFloor);
} else if (auto floatingWindow = qobject_cast<FloatingWindow *>(droppedWindow)) {
if (!validateAffinity(floatingWindow))
return false;
const bool hadSingleFloatingFrame = hasSingleFloatingFrame();
addMultiSplitter(floatingWindow->dropArea(), location, relativeTo, DefaultSizeMode::FairButFloor);
addMultiSplitter(floatingWindow->dropArea(), location, relativeTo,
Layouting::Item::DefaultSizeMode::FairButFloor);
if (hadSingleFloatingFrame != hasSingleFloatingFrame())
updateFloatingActions();

View File

@@ -160,8 +160,9 @@ bool MultiSplitter::validateInputs(QWidgetOrQuick *widget,
}
void MultiSplitter::addWidget(QWidgetOrQuick *w, Location location,
Frame *relativeToWidget, DefaultSizeMode defaultSizeMode,
AddingOption option)
Frame *relativeToWidget,
Layouting::Item::DefaultSizeMode defaultSizeMode,
AddingOption option)
{
auto frame = qobject_cast<Frame*>(w);
qCDebug(addwidget) << Q_FUNC_INFO << w
@@ -226,7 +227,8 @@ void MultiSplitter::addWidget(QWidgetOrQuick *w, Location location,
}
void MultiSplitter::addMultiSplitter(MultiSplitter *sourceMultiSplitter, Location location,
Frame *relativeTo, DefaultSizeMode defaultSizeMode)
Frame *relativeTo,
Layouting::Item::DefaultSizeMode defaultSizeMode)
{
qCDebug(addwidget) << Q_FUNC_INFO << sourceMultiSplitter << location << relativeTo;
addWidget(sourceMultiSplitter, location, relativeTo, defaultSizeMode);

View File

@@ -69,7 +69,9 @@ public:
* @brief Adds a widget to this MultiSplitter.
*/
void addWidget(QWidgetOrQuick *widget, KDDockWidgets::Location location,
Frame *relativeTo = nullptr, DefaultSizeMode = DefaultSizeMode::Fair, AddingOption option = {});
Frame *relativeTo = nullptr,
Layouting::Item::DefaultSizeMode = Layouting::Item::DefaultSizeMode::Fair,
AddingOption option = {});
/**
* Adds an entire MultiSplitter into this layout. The donor MultiSplitter will be deleted
@@ -78,7 +80,8 @@ public:
* of widgetBar when the whole splitter is dropped into this one.
*/
void addMultiSplitter(MultiSplitter *splitter, KDDockWidgets::Location location,
Frame *relativeTo = nullptr, DefaultSizeMode = DefaultSizeMode::Fair);
Frame *relativeTo = nullptr,
Layouting::Item::DefaultSizeMode = Layouting::Item::DefaultSizeMode::Fair);
/**
* @brief Removes an item from this MultiSplitter.