ADS: Make it compile with current Qt dev

Change-Id: Ibea7545b443341da5d079900edcc32439a47c12f
Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
hjk
2020-06-19 09:12:02 +02:00
parent 03838decb9
commit c6b9a03b39
6 changed files with 28 additions and 8 deletions

View File

@@ -145,7 +145,10 @@ void hideEmptyParentSplitters(DockSplitter *firstParentSplitter);
class DockInsertParam : public QPair<Qt::Orientation, bool>
{
public:
using QPair::QPair;
DockInsertParam(Qt::Orientation orientation, bool append)
: QPair<Qt::Orientation, bool>(orientation, append)
{}
Qt::Orientation orientation() const { return this->first; }
bool append() const { return this->second; }
int insertOffset() const { return append() ? 1 : 0; }

View File

@@ -39,6 +39,7 @@
#include "dockareatitlebar.h"
#include <utils/hostosinfo.h>
#include <utils/porting.h>
#include <QCursor>
#include <QGridLayout>
@@ -758,9 +759,9 @@ namespace ADS {
{"Arrow", DockOverlayCross::ArrowColor},
{"Shadow", DockOverlayCross::ShadowColor}};
auto colorList = colors.split(' ', QString::SkipEmptyParts);
auto colorList = colors.split(' ', Utils::SkipEmptyParts);
for (const auto &colorListEntry : colorList) {
auto componentColor = colorListEntry.split('=', QString::SkipEmptyParts);
auto componentColor = colorListEntry.split('=', Utils::SkipEmptyParts);
int component = colorCompenentStringMap.value(componentColor[0], -1);
if (component < 0)
continue;

View File

@@ -136,9 +136,18 @@ namespace ADS {
Super::resizeEvent(event);
}
bool ElidingLabel::hasPixmap() const
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
return !pixmap().isNull();
#else
return pixmap() != nullptr;
#endif
}
QSize ElidingLabel::minimumSizeHint() const
{
if (pixmap() != nullptr || d->isModeElideNone())
if (hasPixmap() || d->isModeElideNone())
return QLabel::minimumSizeHint();
const QFontMetrics &fm = fontMetrics();
@@ -152,7 +161,7 @@ namespace ADS {
QSize ElidingLabel::sizeHint() const
{
if (pixmap() != nullptr || d->isModeElideNone())
if (hasPixmap() || d->isModeElideNone())
return QLabel::sizeHint();
const QFontMetrics &fm = fontMetrics();

View File

@@ -106,6 +106,12 @@ signals:
* This signal is emitted when isElided() state of this label is changed
*/
void elidedChanged(bool elided);
private:
/**
* Helper to port to Qt 6
*/
bool hasPixmap() const;
}; //class ElidingLabel
} // namespace ADS

View File

@@ -555,7 +555,7 @@ static const char* windowsMessageString(int messageId)
setWindowFlags(windowFlags() | Qt::Tool);
QDockWidget::setWidget(d->m_dockContainer);
QDockWidget::setFloating(true);
QDockWidget::setFeatures(QDockWidget::AllDockWidgetFeatures);
QDockWidget::setFeatures(DockWidgetClosable | DockWidgetMovable | DockWidgetFloatable);
setTitleBarWidget(d->m_titleBar);
connect(d->m_titleBar,
&FloatingWidgetTitleBar::closeRequested,

View File

@@ -40,6 +40,7 @@
#include <utils/algorithm.h>
#include <QInputDialog>
#include <QRegularExpression>
#include <QValidator>
namespace ADS {
@@ -64,9 +65,9 @@ QValidator::State WorkspaceValidator::validate(QString &input, int &pos) const
{
Q_UNUSED(pos)
static QRegExp rx("[a-zA-Z0-9 ()\\-]*");
static const QRegularExpression rx("^[a-zA-Z0-9 ()\\-]*$");
if (!rx.exactMatch(input))
if (!rx.match(input).hasMatch())
return QValidator::Invalid;
if (m_workspaces.contains(input))