forked from qt-creator/qt-creator
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:
@@ -145,7 +145,10 @@ void hideEmptyParentSplitters(DockSplitter *firstParentSplitter);
|
|||||||
class DockInsertParam : public QPair<Qt::Orientation, bool>
|
class DockInsertParam : public QPair<Qt::Orientation, bool>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using QPair::QPair;
|
DockInsertParam(Qt::Orientation orientation, bool append)
|
||||||
|
: QPair<Qt::Orientation, bool>(orientation, append)
|
||||||
|
{}
|
||||||
|
|
||||||
Qt::Orientation orientation() const { return this->first; }
|
Qt::Orientation orientation() const { return this->first; }
|
||||||
bool append() const { return this->second; }
|
bool append() const { return this->second; }
|
||||||
int insertOffset() const { return append() ? 1 : 0; }
|
int insertOffset() const { return append() ? 1 : 0; }
|
||||||
|
@@ -39,6 +39,7 @@
|
|||||||
#include "dockareatitlebar.h"
|
#include "dockareatitlebar.h"
|
||||||
|
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
|
#include <utils/porting.h>
|
||||||
|
|
||||||
#include <QCursor>
|
#include <QCursor>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
@@ -758,9 +759,9 @@ namespace ADS {
|
|||||||
{"Arrow", DockOverlayCross::ArrowColor},
|
{"Arrow", DockOverlayCross::ArrowColor},
|
||||||
{"Shadow", DockOverlayCross::ShadowColor}};
|
{"Shadow", DockOverlayCross::ShadowColor}};
|
||||||
|
|
||||||
auto colorList = colors.split(' ', QString::SkipEmptyParts);
|
auto colorList = colors.split(' ', Utils::SkipEmptyParts);
|
||||||
for (const auto &colorListEntry : colorList) {
|
for (const auto &colorListEntry : colorList) {
|
||||||
auto componentColor = colorListEntry.split('=', QString::SkipEmptyParts);
|
auto componentColor = colorListEntry.split('=', Utils::SkipEmptyParts);
|
||||||
int component = colorCompenentStringMap.value(componentColor[0], -1);
|
int component = colorCompenentStringMap.value(componentColor[0], -1);
|
||||||
if (component < 0)
|
if (component < 0)
|
||||||
continue;
|
continue;
|
||||||
|
@@ -136,9 +136,18 @@ namespace ADS {
|
|||||||
Super::resizeEvent(event);
|
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
|
QSize ElidingLabel::minimumSizeHint() const
|
||||||
{
|
{
|
||||||
if (pixmap() != nullptr || d->isModeElideNone())
|
if (hasPixmap() || d->isModeElideNone())
|
||||||
return QLabel::minimumSizeHint();
|
return QLabel::minimumSizeHint();
|
||||||
|
|
||||||
const QFontMetrics &fm = fontMetrics();
|
const QFontMetrics &fm = fontMetrics();
|
||||||
@@ -152,7 +161,7 @@ namespace ADS {
|
|||||||
|
|
||||||
QSize ElidingLabel::sizeHint() const
|
QSize ElidingLabel::sizeHint() const
|
||||||
{
|
{
|
||||||
if (pixmap() != nullptr || d->isModeElideNone())
|
if (hasPixmap() || d->isModeElideNone())
|
||||||
return QLabel::sizeHint();
|
return QLabel::sizeHint();
|
||||||
|
|
||||||
const QFontMetrics &fm = fontMetrics();
|
const QFontMetrics &fm = fontMetrics();
|
||||||
|
@@ -106,6 +106,12 @@ signals:
|
|||||||
* This signal is emitted when isElided() state of this label is changed
|
* This signal is emitted when isElided() state of this label is changed
|
||||||
*/
|
*/
|
||||||
void elidedChanged(bool elided);
|
void elidedChanged(bool elided);
|
||||||
|
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* Helper to port to Qt 6
|
||||||
|
*/
|
||||||
|
bool hasPixmap() const;
|
||||||
}; //class ElidingLabel
|
}; //class ElidingLabel
|
||||||
|
|
||||||
} // namespace ADS
|
} // namespace ADS
|
||||||
|
@@ -555,7 +555,7 @@ static const char* windowsMessageString(int messageId)
|
|||||||
setWindowFlags(windowFlags() | Qt::Tool);
|
setWindowFlags(windowFlags() | Qt::Tool);
|
||||||
QDockWidget::setWidget(d->m_dockContainer);
|
QDockWidget::setWidget(d->m_dockContainer);
|
||||||
QDockWidget::setFloating(true);
|
QDockWidget::setFloating(true);
|
||||||
QDockWidget::setFeatures(QDockWidget::AllDockWidgetFeatures);
|
QDockWidget::setFeatures(DockWidgetClosable | DockWidgetMovable | DockWidgetFloatable);
|
||||||
setTitleBarWidget(d->m_titleBar);
|
setTitleBarWidget(d->m_titleBar);
|
||||||
connect(d->m_titleBar,
|
connect(d->m_titleBar,
|
||||||
&FloatingWidgetTitleBar::closeRequested,
|
&FloatingWidgetTitleBar::closeRequested,
|
||||||
|
@@ -40,6 +40,7 @@
|
|||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
|
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
|
#include <QRegularExpression>
|
||||||
#include <QValidator>
|
#include <QValidator>
|
||||||
|
|
||||||
namespace ADS {
|
namespace ADS {
|
||||||
@@ -64,9 +65,9 @@ QValidator::State WorkspaceValidator::validate(QString &input, int &pos) const
|
|||||||
{
|
{
|
||||||
Q_UNUSED(pos)
|
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;
|
return QValidator::Invalid;
|
||||||
|
|
||||||
if (m_workspaces.contains(input))
|
if (m_workspaces.contains(input))
|
||||||
|
Reference in New Issue
Block a user