Fix Qt6 building (#4393)
This commit is contained in:
@@ -641,8 +641,8 @@ void Notebook::performLayout(bool animated)
|
||||
bool isLastColumn = col == columnCount - 1;
|
||||
auto largestWidth = 0;
|
||||
int tabStart = col * tabsPerColumn;
|
||||
int tabEnd =
|
||||
std::min((col + 1) * tabsPerColumn, this->items_.size());
|
||||
int tabEnd = std::min((col + 1) * tabsPerColumn,
|
||||
(int)this->items_.size());
|
||||
|
||||
for (int i = tabStart; i < tabEnd; i++)
|
||||
{
|
||||
@@ -743,8 +743,8 @@ void Notebook::performLayout(bool animated)
|
||||
bool isLastColumn = col == columnCount - 1;
|
||||
auto largestWidth = 0;
|
||||
int tabStart = col * tabsPerColumn;
|
||||
int tabEnd =
|
||||
std::min((col + 1) * tabsPerColumn, this->items_.size());
|
||||
int tabEnd = std::min((col + 1) * tabsPerColumn,
|
||||
(int)this->items_.size());
|
||||
|
||||
for (int i = tabStart; i < tabEnd; i++)
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "widgets/settingspages/NotificationPage.hpp"
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QFile>
|
||||
#include <QLineEdit>
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
@@ -62,7 +62,11 @@ QString ResizingTextEdit::textUnderCursor(bool *hadSpace) const
|
||||
|
||||
auto textUpToCursor = currentText.left(tc.selectionStart());
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
auto words = QStringView{textUpToCursor}.split(' ');
|
||||
#else
|
||||
auto words = textUpToCursor.splitRef(' ');
|
||||
#endif
|
||||
if (words.size() == 0)
|
||||
{
|
||||
return QString();
|
||||
|
||||
@@ -54,7 +54,7 @@ void SettingsDialogTab::paintEvent(QPaintEvent *)
|
||||
QPainter painter(this);
|
||||
|
||||
QStyleOption opt;
|
||||
opt.init(this);
|
||||
opt.initFrom(this);
|
||||
|
||||
this->style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "widgets/BasePopup.hpp"
|
||||
#include "widgets/helper/SignalLabel.hpp"
|
||||
|
||||
#include <QFile>
|
||||
#include <QFormLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QLabel>
|
||||
@@ -144,7 +145,11 @@ AboutPage::AboutPage()
|
||||
contributorsFile.open(QFile::ReadOnly);
|
||||
|
||||
QTextStream stream(&contributorsFile);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
// Default encoding of QTextStream is already UTF-8
|
||||
#else
|
||||
stream.setCodec("UTF-8");
|
||||
#endif
|
||||
|
||||
QString line;
|
||||
|
||||
|
||||
@@ -112,35 +112,36 @@ ModerationPage::ModerationPage()
|
||||
// Show how big (size-wise) the logs are
|
||||
auto logsPathSizeLabel = logs.emplace<QLabel>();
|
||||
logsPathSizeLabel->setText(QtConcurrent::run([] {
|
||||
return fetchLogDirectorySize();
|
||||
}));
|
||||
return fetchLogDirectorySize();
|
||||
}).result());
|
||||
|
||||
// Select event
|
||||
QObject::connect(selectDir.getElement(), &QPushButton::clicked, this,
|
||||
[this, logsPathSizeLabel]() mutable {
|
||||
auto dirName =
|
||||
QFileDialog::getExistingDirectory(this);
|
||||
QObject::connect(
|
||||
selectDir.getElement(), &QPushButton::clicked, this,
|
||||
[this, logsPathSizeLabel]() mutable {
|
||||
auto dirName = QFileDialog::getExistingDirectory(this);
|
||||
|
||||
getSettings()->logPath = dirName;
|
||||
getSettings()->logPath = dirName;
|
||||
|
||||
// Refresh: Show how big (size-wise) the logs are
|
||||
logsPathSizeLabel->setText(QtConcurrent::run([] {
|
||||
return fetchLogDirectorySize();
|
||||
}));
|
||||
});
|
||||
// Refresh: Show how big (size-wise) the logs are
|
||||
logsPathSizeLabel->setText(QtConcurrent::run([] {
|
||||
return fetchLogDirectorySize();
|
||||
}).result());
|
||||
});
|
||||
|
||||
buttons->addSpacing(16);
|
||||
|
||||
// Reset custom logpath
|
||||
QObject::connect(resetDir.getElement(), &QPushButton::clicked, this,
|
||||
[logsPathSizeLabel]() mutable {
|
||||
getSettings()->logPath = "";
|
||||
QObject::connect(
|
||||
resetDir.getElement(), &QPushButton::clicked, this,
|
||||
[logsPathSizeLabel]() mutable {
|
||||
getSettings()->logPath = "";
|
||||
|
||||
// Refresh: Show how big (size-wise) the logs are
|
||||
logsPathSizeLabel->setText(QtConcurrent::run([] {
|
||||
return fetchLogDirectorySize();
|
||||
}));
|
||||
});
|
||||
// Refresh: Show how big (size-wise) the logs are
|
||||
logsPathSizeLabel->setText(QtConcurrent::run([] {
|
||||
return fetchLogDirectorySize();
|
||||
}).result());
|
||||
});
|
||||
|
||||
QCheckBox *onlyLogListedChannels =
|
||||
this->createCheckBox("Only log channels listed below",
|
||||
|
||||
@@ -699,7 +699,7 @@ void SplitInput::updateCompletionPopup()
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = clamp(position, 0, text.length() - 1); i >= 0; i--)
|
||||
for (int i = clamp(position, 0, (int)text.length() - 1); i >= 0; i--)
|
||||
{
|
||||
if (text[i] == ' ')
|
||||
{
|
||||
@@ -766,7 +766,7 @@ void SplitInput::showCompletionPopup(const QString &text, bool emoteCompletion)
|
||||
popup->updateUsers(text, this->split_->getChannel());
|
||||
}
|
||||
|
||||
auto pos = this->mapToGlobal({0, 0}) - QPoint(0, popup->height()) +
|
||||
auto pos = this->mapToGlobal(QPoint{0, 0}) - QPoint(0, popup->height()) +
|
||||
QPoint((this->width() - popup->width()) / 2, 0);
|
||||
|
||||
popup->move(pos);
|
||||
@@ -789,7 +789,7 @@ void SplitInput::insertCompletionText(const QString &input_) const
|
||||
auto text = edit.toPlainText();
|
||||
auto position = edit.textCursor().position() - 1;
|
||||
|
||||
for (int i = clamp(position, 0, text.length() - 1); i >= 0; i--)
|
||||
for (int i = clamp(position, 0, (int)text.length() - 1); i >= 0; i--)
|
||||
{
|
||||
bool done = false;
|
||||
if (text[i] == ':')
|
||||
|
||||
Reference in New Issue
Block a user