Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/collections/buttonexample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ DPushButtonExample::DPushButtonExample(QWidget *parent)
DPushButton *pButtonDisabled = new DPushButton("button disabled", this);
pButtonDisabled->setFixedSize(DSizeModeHelper::element(QSize(200, 24), QSize(200, 36)));
// connect `sizeModeChanged()` signal to update Size.
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::sizeModeChanged, [pButtonDisabled](DGuiApplicationHelper::SizeMode mode) {
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::sizeModeChanged, [pButtonDisabled](DGuiApplicationHelper::SizeMode) {
pButtonDisabled->setFixedSize(DSizeModeHelper::element(QSize(200, 24), QSize(200, 36)));
});
pButtonDisabled->setEnabled(false);
Expand Down Expand Up @@ -402,7 +402,7 @@ DIconButtonExample::DIconButtonExample(QWidget *parent)
pButton_8->setIconSize(QSize(16, 16));
DStyle::setFocusRectVisible(pButton_8, false);

auto updateButtonSize = [](QWidget *widget, int mode) {
auto updateButtonSize = [](QWidget *widget, int) {
for (auto button : widget->findChildren<DIconButton *>(QString(), Qt::FindDirectChildrenOnly)) {
if (button->iconSize() == QSize(16, 16)) {
button->setFixedSize(DSizeModeHelper::element(QSize(20, 20), QSize(24, 24)));
Expand Down
2 changes: 2 additions & 0 deletions examples/collections/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ int main(int argc, char *argv[])
#endif
DApplication *a = DApplication::globalApplication(argc, argv);

#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
DApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true);
#endif
DLogManager::registerConsoleAppender();

a->loadTranslator();
Expand Down
4 changes: 2 additions & 2 deletions examples/collections/widgetexample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
return QString::number(days);
}
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
case Qt::TextColorRole: {
#else
case Qt::ForegroundRole:{
Expand All @@ -176,10 +176,10 @@
return QVariant();
}

QVariant CalendarModel::headerData(int section, Qt::Orientation orientation, int role) const

Check warning on line 179 in examples/collections/widgetexample.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'headerData' is never used.

Check warning on line 179 in examples/collections/widgetexample.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

The function 'headerData' is never used.
{
if (
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
role == Qt::BackgroundColorRole ||
#endif
role == Qt::BackgroundRole)
Expand Down
2 changes: 1 addition & 1 deletion include/util/dapplicationsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class DApplicationSettings : public QObject, public DCORE_NAMESPACE::DObject
D_DECLARE_PRIVATE(DApplicationSettings)

public:
Q_DECL_DEPRECATED_X("The feature has been moved to DGuiApplicationHelper, We can disable it by setting DGuiApplicationHelper::DontSaveApplicationTheme enum with setAttribute.")
D_DECL_DEPRECATED_X("The feature has been moved to DGuiApplicationHelper, We can disable it by setting DGuiApplicationHelper::DontSaveApplicationTheme enum with setAttribute.")
explicit DApplicationSettings(QObject *parent = nullptr);

private:
Expand Down
4 changes: 2 additions & 2 deletions include/util/dhidpihelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

DWIDGET_BEGIN_NAMESPACE

class Q_DECL_DEPRECATED DHiDPIHelper
class D_DECL_DEPRECATED DHiDPIHelper
{
public:
Q_DECL_DEPRECATED_X("Use Dtk::Gui::DIcon::loadNxPixmap") static QPixmap loadNxPixmap(const QString &fileName);
D_DECL_DEPRECATED_X("Use Dtk::Gui::DIcon::loadNxPixmap") static QPixmap loadNxPixmap(const QString &fileName);
};

DWIDGET_END_NAMESPACE
Expand Down
2 changes: 0 additions & 2 deletions plugin/dtkuiplugin/dcustomermacrowidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,14 @@
#include <DTabBar>
#include <DWaterProgress>
#include <DShadowLine>
#include <DTextEdit>

Check warning on line 36 in plugin/dtkuiplugin/dcustomermacrowidget.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <DTextEdit> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 36 in plugin/dtkuiplugin/dcustomermacrowidget.h

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <DTextEdit> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <DSearchComboBox>

Check warning on line 37 in plugin/dtkuiplugin/dcustomermacrowidget.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <DSearchComboBox> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 37 in plugin/dtkuiplugin/dcustomermacrowidget.h

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <DSearchComboBox> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <DSpinBox>

Check warning on line 38 in plugin/dtkuiplugin/dcustomermacrowidget.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <DSpinBox> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 38 in plugin/dtkuiplugin/dcustomermacrowidget.h

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <DSpinBox> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <DSegmentedHighlight>
#include <DSpinner>

Check warning on line 39 in plugin/dtkuiplugin/dcustomermacrowidget.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <DSpinner> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 39 in plugin/dtkuiplugin/dcustomermacrowidget.h

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <DSpinner> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <DToolButton>

Check warning on line 40 in plugin/dtkuiplugin/dcustomermacrowidget.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <DToolButton> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 40 in plugin/dtkuiplugin/dcustomermacrowidget.h

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <DToolButton> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <DSegmentedControl>
#include <DSuggestButton>

Check warning on line 41 in plugin/dtkuiplugin/dcustomermacrowidget.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <DSuggestButton> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 41 in plugin/dtkuiplugin/dcustomermacrowidget.h

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <DSuggestButton> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <DSwitchButton>

Check warning on line 42 in plugin/dtkuiplugin/dcustomermacrowidget.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <DSwitchButton> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 42 in plugin/dtkuiplugin/dcustomermacrowidget.h

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <DSwitchButton> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <DWarningButton>

Check warning on line 43 in plugin/dtkuiplugin/dcustomermacrowidget.h

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <DWarningButton> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 43 in plugin/dtkuiplugin/dcustomermacrowidget.h

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <DWarningButton> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <DSearchEdit>

// not added
Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ target_compile_definitions(${LIBNAME} PRIVATE
DTK_NO_MULTIMEDIA
DWIDGET_TRANSLATIONS_DIR="${TRANSLATIONS_INSTALL_DIR}"
LIBDTKWIDGET_LIBRARY
D_IGNORE_DEPRECATIONS
)

if(DTK_STATIC_TRANSLATION)
Expand Down
3 changes: 2 additions & 1 deletion src/util/dwidgetutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QDesktopWidget>
#endif
#include <QScreen>

Check warning on line 15 in src/util/dwidgetutil.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QScreen> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 15 in src/util/dwidgetutil.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <QScreen> not found. Please note: Cppcheck does not need standard library headers to get proper results.

QT_BEGIN_NAMESPACE
//extern Q_WIDGETS_EXPORT void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed = 0);
Expand Down Expand Up @@ -60,7 +61,7 @@
void moveToCenter(QWidget *w)
{
Q_ASSERT(w != nullptr);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
QDesktopWidget *dw = QApplication::desktop();
QRect parentRect = dw->availableGeometry(dw->primaryScreen());
#else
Expand Down
3 changes: 2 additions & 1 deletion src/widgets/daboutdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,8 @@ QPixmap DAboutDialog::companyLogo() const
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
return d->companyLogoLabel->pixmap(Qt::ReturnByValue);
#else
return d->companyLogoLabel->pixmap();
const_cast<DAboutDialogPrivate* >(d)->companyLogoPixmap = d->companyLogoLabel->pixmap(Qt::ReturnByValue);
return &(d->companyLogoPixmap);
#endif
}

Expand Down
1 change: 1 addition & 0 deletions src/widgets/dbaseexpand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ DBaseExpandPrivate::~DBaseExpandPrivate()
@fn void DBaseExpand::expandChange(bool e)
@brief content widget visibility signal
@param[in] e If "true", the content widget becomes visible, otherwise, the content widget becomes invisible.
*/

/*!
@~english
Expand Down
2 changes: 2 additions & 0 deletions src/widgets/dfontcombobox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ DFontComboBoxPrivate::~DFontComboBoxPrivate()
@endcode

@image html DFontComboBox.png
*/

/*!
@~english
@brief DFontComboBox constructor.
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/dlineedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ bool DLineEdit::eventFilter(QObject *watched, QEvent *event)
D_D(DLineEdit);

if (event->type() == QEvent::FocusIn) {
if (DGuiApplicationHelper::IsTableEnvironment && QGuiApplication::inputMethod())
if (DGuiApplicationHelper::testAttribute(DGuiApplicationHelper::IsTableEnvironment) && QGuiApplication::inputMethod() != nullptr)
QGuiApplication::inputMethod()->show();
Q_EMIT focusChanged(true);
} else if (event->type() == QEvent::FocusOut) {
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/dprintpreviewwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1222,7 +1222,7 @@ QVector<int> DPrintPreviewWidgetPrivate::requestPages(int page)
\a parent 父控件
*/
DPrintPreviewWidget::DPrintPreviewWidget(DPrinter *printer, QWidget *parent)
: DFrame(*new DPrintPreviewWidgetPrivate(this))
: DFrame(*new DPrintPreviewWidgetPrivate(this), parent)
{
Q_D(DPrintPreviewWidget);
d->previewPrinter = printer;
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/dstyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2194,7 +2194,7 @@ void DStyle::drawControl(QStyle::ControlElement ce, const QStyleOption *opt, QPa
*/
int DStyle::pixelMetric(QStyle::PixelMetric m, const QStyleOption *opt, const QWidget *widget) const
{
switch (m) {
switch (static_cast<uint32_t>(m)) {
case PM_ButtonDefaultIndicator:
case PM_ButtonShiftHorizontal:
case PM_ButtonShiftVertical:
Expand Down
8 changes: 5 additions & 3 deletions src/widgets/dstyleditemdelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ DWIDGET_END_NAMESPACE
Q_DECLARE_METATYPE(DTK_WIDGET_NAMESPACE::ActionList)

DWIDGET_BEGIN_NAMESPACE
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
static void saveDViewItemActionList(QDataStream &s, const void *d)
{
const ActionList &data = *static_cast<const ActionList*>(d);
Expand All @@ -95,17 +96,18 @@ static void loadDViewItemActionList(QDataStream &s, void *d)
s >> data;
}

__attribute__((constructor))
static void registerMetaType ()
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
// register DViewItemActionList's stream operator to support that QMetaType can using save and load function.
QMetaType::registerStreamOperators(QMetaTypeId<DTK_WIDGET_NAMESPACE::ActionList>::qt_metatype_id(),
saveDViewItemActionList,
loadDViewItemActionList);
#endif
}

Q_CONSTRUCTOR_FUNCTION(registerMetaType)

#endif

static DViewItemActionList qvariantToActionList(const QVariant &v)
{
const ActionList &wrapper = v.value<ActionList>();
Expand Down
3 changes: 3 additions & 0 deletions src/widgets/private/daboutdialog_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ class DAboutDialogPrivate : public DDialogPrivate
QLabel *licenseTipLabel = nullptr;
QLabel *licenseLabel = nullptr;
QLabel *companyLogoLabel = nullptr;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QPixmap companyLogoPixmap;
#endif
QLabel *websiteLabel = nullptr;
QLabel *featureLabel = nullptr;
DRedPointLabel *redPointLabel = nullptr;
Expand Down
4 changes: 2 additions & 2 deletions src/widgets/private/dprintpreviewwidget_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ struct DPrintPreviewWidgetPrivate::NumberUpData {

QVector<QPointF> updatePositions(const qreal &scale)
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
QRectF pageRect = parent->previewPrinter->pageLayout().paintRectPixels(parent->previewPrinter->resolution());
#else
QRectF pageRect = parent->previewPrinter->pageRect();
Expand Down Expand Up @@ -474,7 +474,7 @@ struct DPrintPreviewWidgetPrivate::NumberUpData {
{
if (waterList.isEmpty())
return;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
QRectF pageRect = parent->previewPrinter->pageLayout().paintRectPixels(parent->previewPrinter->resolution());
#else
QRectF pageRect = parent->previewPrinter->pageRect();
Expand Down
4 changes: 2 additions & 2 deletions src/widgets/private/dtitlebareditpanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ void DCollapseWidget::updateMinimumValue()
continue;
minimum += w->width();
qDebug() << "+" << w->width();
if (auto dragDropWidget = qobject_cast<DragDropWidget *>(w)) {
if (qobject_cast<DragDropWidget *>(w)) {
if (m_settingsImpl->isSpacerTool(m_settingsImpl->findKeyByPos(i)) && !m_settingsImpl->isStrecherTool(m_settingsImpl->findKeyByPos(i))) {
minimum += SPACING;
qDebug() << "+" << SPACING;
Expand Down Expand Up @@ -402,7 +402,7 @@ void DCollapseWidget::collapse()
}

if (auto item = m_mainHLayout->takeAt(index)) {
if (auto spacerItem = item->spacerItem()) { // 如果是spacer,只存数据,不处理expand按钮
if (item->spacerItem()) { // 如果是spacer,只存数据,不处理expand按钮
QPair<QString, QWidget*> tmp{m_settingsImpl->findKeyByPos(index), nullptr};
m_viewsInMenu.append(tmp);
qDebug() << "collapse:" << m_viewsInMenu;
Expand Down
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ target_compile_definitions(${BINNAME} PRIVATE
SN_API_NOT_YET_FROZEN
DTK_NO_MULTIMEDIA
DWIDGET_TRANSLATIONS_DIR="dtk${PROJECT_VERSION_MAJOR}/DWidget/translations"
D_IGNORE_DEPRECATIONS
)

if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
Expand Down
2 changes: 1 addition & 1 deletion tests/testcases/widgets/ut_dcombobox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ TEST_F(ut_DComboBox, maxVisibleItems)
target->addItem(QString::number(i));
}
target->show();
QTest::qWaitForWindowExposed(target->windowHandle());
(void)QTest::qWaitForWindowExposed(target->windowHandle());

const QPoint arrowPos(target->rect().right() - 1, target->rect().center().y());
QTest::mouseClick(target, Qt::LeftButton, Qt::KeyboardModifiers(), arrowPos);
Expand Down
4 changes: 4 additions & 0 deletions tests/testcases/widgets/ut_dtextedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ TEST_F(ut_DTextEdit, testDTextEditKeyPressEvent)

TEST_F(ut_DTextEdit, testDTextEditContextMenuEvent)
{
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
QContextMenuEvent menuEvent(QContextMenuEvent::Mouse, QPoint(0,0), QPoint(0,0));
#else
QContextMenuEvent menuEvent(QContextMenuEvent::Mouse, QPoint(0,0));
#endif
widget->contextMenuEvent(&menuEvent);
}
Loading