Skip to content

Commit

Permalink
Fix ODR violations when using CMake unity builds. (#609)
Browse files Browse the repository at this point in the history
  • Loading branch information
tnixeu authored Feb 28, 2024
1 parent 6bf593e commit fb58c43
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
5 changes: 2 additions & 3 deletions src/AutoHideTab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@

namespace ads
{
static const char* const LocationProperty = "Location";

/**
* Private data class of CDockWidgetTab class (pimpl)
Expand Down Expand Up @@ -102,7 +101,7 @@ struct AutoHideTabPrivate
QMenu* Menu)
{
auto Action = Menu->addAction(Title);
Action->setProperty("Location", Location);
Action->setProperty(internal::LocationProperty, Location);
QObject::connect(Action, &QAction::triggered, _this, &CAutoHideTab::onAutoHideToActionClicked);
Action->setEnabled(Location != _this->sideBarLocation());
return Action;
Expand Down Expand Up @@ -419,7 +418,7 @@ void CAutoHideTab::unpinDockWidget()
//===========================================================================
void CAutoHideTab::onAutoHideToActionClicked()
{
int Location = sender()->property(LocationProperty).toInt();
int Location = sender()->property(internal::LocationProperty).toInt();
d->DockWidget->setAutoHide(true, (SideBarLocation)Location);
}

Expand Down
5 changes: 2 additions & 3 deletions src/DockAreaTitleBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@

namespace ads
{
static const char* const LocationProperty = "Location";

/**
* Private data class of CDockAreaTitleBar class (pimpl)
Expand Down Expand Up @@ -159,7 +158,7 @@ struct DockAreaTitleBarPrivate
QMenu* Menu)
{
auto Action = Menu->addAction(Title);
Action->setProperty("Location", Location);
Action->setProperty(internal::LocationProperty, Location);
QObject::connect(Action, &QAction::triggered, _this, &CDockAreaTitleBar::onAutoHideToActionClicked);
return Action;
}
Expand Down Expand Up @@ -569,7 +568,7 @@ void CDockAreaTitleBar::onAutoHideDockAreaActionClicked()
//============================================================================
void CDockAreaTitleBar::onAutoHideToActionClicked()
{
int Location = sender()->property(LocationProperty).toInt();
int Location = sender()->property(internal::LocationProperty).toInt();
d->DockArea->toggleAutoHide((SideBarLocation)Location);
}

Expand Down
5 changes: 2 additions & 3 deletions src/DockWidgetTab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@

namespace ads
{
static const char* const LocationProperty = "Location";
using tTabLabel = CElidingLabel;

/**
Expand Down Expand Up @@ -225,7 +224,7 @@ struct DockWidgetTabPrivate
QMenu* Menu)
{
auto Action = Menu->addAction(Title);
Action->setProperty("Location", Location);
Action->setProperty(internal::LocationProperty, Location);
QObject::connect(Action, &QAction::triggered, _this, &CDockWidgetTab::onAutoHideToActionClicked);
return Action;
}
Expand Down Expand Up @@ -764,7 +763,7 @@ void CDockWidgetTab::autoHideDockWidget()
//===========================================================================
void CDockWidgetTab::onAutoHideToActionClicked()
{
int Location = sender()->property(LocationProperty).toInt();
int Location = sender()->property(internal::LocationProperty).toInt();
d->DockWidget->toggleAutoHide((SideBarLocation)Location);
}

Expand Down
6 changes: 3 additions & 3 deletions src/FloatingDockContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,15 +357,15 @@ static const char* windowsMessageString(int MessageId)
#endif


static unsigned int zOrderCounter = 0;
static unsigned int zOrderCounterFloating = 0;
/**
* Private data class of CFloatingDockContainer class (pimpl)
*/
struct FloatingDockContainerPrivate
{
CFloatingDockContainer *_this;
CDockContainerWidget *DockContainer;
unsigned int zOrderIndex = ++zOrderCounter;
unsigned int zOrderIndex = ++zOrderCounterFloating;
QPointer<CDockManager> DockManager;
eDragState DraggingState = DraggingInactive;
QPoint DragStartMousePosition;
Expand Down Expand Up @@ -818,7 +818,7 @@ void CFloatingDockContainer::changeEvent(QEvent *event)
if (isActiveWindow())
{
ADS_PRINT("FloatingWidget::changeEvent QEvent::ActivationChange ");
d->zOrderIndex = ++zOrderCounter;
d->zOrderIndex = ++zOrderCounterFloating;

#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
if (d->DraggingState == DraggingFloatingWidget)
Expand Down
1 change: 1 addition & 0 deletions src/ads_globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ static const bool RestoreTesting = true;
static const bool Restore = false;
static const char* const ClosedProperty = "close";
static const char* const DirtyProperty = "dirty";
static const char* const LocationProperty = "Location";
extern const int FloatingWidgetDragStartEvent;
extern const int DockedWidgetDragStartEvent;

Expand Down

0 comments on commit fb58c43

Please sign in to comment.