Fixes to compile with Qt 4.6.

This commit is contained in:
Leonardo 2016-09-22 08:04:51 -07:00
parent a90cd13697
commit dc2b5db0a7
12 changed files with 58 additions and 29 deletions

View file

@ -315,9 +315,17 @@ void lcPiecesLibrary::ReadArchiveDescriptions(const QString& OfficialFileName, c
QFileInfo UnofficialInfo(UnofficialFileName);
mArchiveCheckSum[0] = OfficialInfo.size();
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
mArchiveCheckSum[1] = OfficialInfo.lastModified().toMSecsSinceEpoch();
#else
mArchiveCheckSum[1] = OfficialInfo.lastModified().toTime_t();
#endif
mArchiveCheckSum[2] = UnofficialInfo.size();
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
mArchiveCheckSum[3] = UnofficialInfo.lastModified().toMSecsSinceEpoch();
#else
mArchiveCheckSum[3] = UnofficialInfo.lastModified().toTime_t();
#endif
QString IndexFileName = QFileInfo(QDir(mCachePath), QLatin1String("index")).absoluteFilePath();

View file

@ -810,11 +810,15 @@ void lcMainWindow::Print(QPrinter* Printer)
if (Printer->collateCopies())
{
DocCopies = 1;
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
PageCopies = Printer->supportsMultipleCopies() ? 1 : Printer->copyCount();
#endif
}
else
{
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
DocCopies = Printer->supportsMultipleCopies() ? 1 : Printer->copyCount();
#endif
PageCopies = 1;
}

View file

@ -133,8 +133,10 @@ void lcMouseShortcuts::Reset()
memset(mShortcuts, 0, sizeof(mShortcuts));
mShortcuts[LC_TOOL_ROTATE_VIEW].Modifiers = Qt::AltModifier;
mShortcuts[LC_TOOL_ROTATE_VIEW].Button = Qt::LeftButton;
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
mShortcuts[LC_TOOL_PAN].Modifiers = Qt::AltModifier;
mShortcuts[LC_TOOL_PAN].Button = Qt::MiddleButton;
#endif
mShortcuts[LC_TOOL_ZOOM].Modifiers = Qt::AltModifier;
mShortcuts[LC_TOOL_ZOOM].Button = Qt::RightButton;
}

View file

@ -178,8 +178,7 @@ void lcTimelineWidget::Update(bool Clear, bool UpdateItems)
int Size = rowHeight(indexFromItem(PieceItem));
QImage Image(Size, Size, QImage::Format_ARGB32);
Image.fill(QColor::fromRgbF(1.0, 1.0, 1.0, 0.0));
Image.fill(0);
float* Color = gColorList[ColorIndex].Value;
QPainter Painter(&Image);
Painter.setPen(Qt::NoPen);

View file

@ -172,7 +172,9 @@ lcModel* Project::CreateNewModel(bool ShowModel)
void Project::ShowModelListDialog()
{
QList<QPair<QString, lcModel*>> Models;
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
Models.reserve(mModels.GetSize());
#endif
for (int ModelIdx = 0; ModelIdx < mModels.GetSize(); ModelIdx++)
{

View file

@ -2519,7 +2519,7 @@ void View::OnMiddleButtonDown()
}
gMainWindow->SetActiveView(this);
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
lcTrackTool OverrideTool = GetOverrideTrackTool(Qt::MiddleButton);
if (OverrideTool != LC_TRACKTOOL_NONE)
@ -2527,7 +2527,7 @@ void View::OnMiddleButtonDown()
mTrackTool = OverrideTool;
OnUpdateCursor();
}
#endif
OnButtonDown(LC_TRACKBUTTON_MIDDLE);
}

View file

@ -8,24 +8,24 @@ lcQArrayDialog::lcQArrayDialog(QWidget* Parent)
{
ui->setupUi(this);
ui->offset1x->setValidator(new QDoubleValidator());
ui->offset1y->setValidator(new QDoubleValidator());
ui->offset1z->setValidator(new QDoubleValidator());
ui->offset2x->setValidator(new QDoubleValidator());
ui->offset2y->setValidator(new QDoubleValidator());
ui->offset2z->setValidator(new QDoubleValidator());
ui->offset3x->setValidator(new QDoubleValidator());
ui->offset3y->setValidator(new QDoubleValidator());
ui->offset3z->setValidator(new QDoubleValidator());
ui->rotation1x->setValidator(new QDoubleValidator());
ui->rotation1y->setValidator(new QDoubleValidator());
ui->rotation1z->setValidator(new QDoubleValidator());
ui->rotation2x->setValidator(new QDoubleValidator());
ui->rotation2y->setValidator(new QDoubleValidator());
ui->rotation2z->setValidator(new QDoubleValidator());
ui->rotation3x->setValidator(new QDoubleValidator());
ui->rotation3y->setValidator(new QDoubleValidator());
ui->rotation3z->setValidator(new QDoubleValidator());
ui->offset1x->setValidator(new QDoubleValidator(ui->offset1x));
ui->offset1y->setValidator(new QDoubleValidator(ui->offset1y));
ui->offset1z->setValidator(new QDoubleValidator(ui->offset1z));
ui->offset2x->setValidator(new QDoubleValidator(ui->offset2x));
ui->offset2y->setValidator(new QDoubleValidator(ui->offset2y));
ui->offset2z->setValidator(new QDoubleValidator(ui->offset2z));
ui->offset3x->setValidator(new QDoubleValidator(ui->offset3x));
ui->offset3y->setValidator(new QDoubleValidator(ui->offset3y));
ui->offset3z->setValidator(new QDoubleValidator(ui->offset3z));
ui->rotation1x->setValidator(new QDoubleValidator(ui->rotation1x));
ui->rotation1y->setValidator(new QDoubleValidator(ui->rotation1y));
ui->rotation1z->setValidator(new QDoubleValidator(ui->rotation1z));
ui->rotation2x->setValidator(new QDoubleValidator(ui->rotation2x));
ui->rotation2y->setValidator(new QDoubleValidator(ui->rotation2y));
ui->rotation2z->setValidator(new QDoubleValidator(ui->rotation2z));
ui->rotation3x->setValidator(new QDoubleValidator(ui->rotation3x));
ui->rotation3y->setValidator(new QDoubleValidator(ui->rotation3y));
ui->rotation3z->setValidator(new QDoubleValidator(ui->rotation3z));
mCounts[0] = 10;
mCounts[1] = 1;

View file

@ -9,10 +9,10 @@ lcQHTMLDialog::lcQHTMLDialog(QWidget *parent, void *data) :
{
ui->setupUi(this);
ui->stepWidth->setValidator(new QIntValidator(0, 2048));
ui->stepHeight->setValidator(new QIntValidator(0, 2048));
ui->partImagesWidth->setValidator(new QIntValidator(0, 2048));
ui->partImagesHeight->setValidator(new QIntValidator(0, 2048));
ui->stepWidth->setValidator(new QIntValidator(0, 2048, ui->stepWidth));
ui->stepHeight->setValidator(new QIntValidator(0, 2048, ui->stepHeight));
ui->partImagesWidth->setValidator(new QIntValidator(0, 2048, ui->partImagesWidth));
ui->partImagesHeight->setValidator(new QIntValidator(0, 2048, ui->partImagesHeight));
options = (lcHTMLDialogOptions*)data;

View file

@ -15,7 +15,7 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget *parent, void *data) :
{
ui->setupUi(this);
ui->lineWidth->setValidator(new QDoubleValidator());
ui->lineWidth->setValidator(new QDoubleValidator(ui->lineWidth));
connect(ui->gridStudColor, SIGNAL(clicked()), this, SLOT(colorClicked()));
connect(ui->gridLineColor, SIGNAL(clicked()), this, SLOT(colorClicked()));
connect(ui->categoriesTree, SIGNAL(itemSelectionChanged()), this, SLOT(updateParts()));
@ -617,9 +617,11 @@ void lcQPreferencesDialog::UpdateMouseTreeItem(int ItemIndex)
Shortcut += tr("Left Button");
break;
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
case Qt::MiddleButton:
Shortcut += tr("Middle Button");
break;
#endif
case Qt::RightButton:
Shortcut += tr("Right Button");
@ -656,9 +658,11 @@ void lcQPreferencesDialog::on_mouseAssign_clicked()
Button = Qt::LeftButton;
break;
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
case 2:
Button = Qt::MiddleButton;
break;
#endif
case 3:
Button = Qt::RightButton;
@ -746,9 +750,11 @@ void lcQPreferencesDialog::MouseTreeItemChanged(QTreeWidgetItem* Current)
ui->mouseButton->setCurrentIndex(1);
break;
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
case Qt::MiddleButton:
ui->mouseButton->setCurrentIndex(2);
break;
#endif
case Qt::RightButton:
ui->mouseButton->setCurrentIndex(3);

View file

@ -14,7 +14,7 @@ lcQPropertiesDialog::lcQPropertiesDialog(QWidget *parent, void *data) :
{
ui->setupUi(this);
ui->fogDensityEdit->setValidator(new QDoubleValidator());
ui->fogDensityEdit->setValidator(new QDoubleValidator(ui->fogDensityEdit));
connect(ui->solidColorButton, SIGNAL(clicked()), this, SLOT(colorClicked()));
connect(ui->gradient1ColorButton, SIGNAL(clicked()), this, SLOT(colorClicked()));

View file

@ -424,7 +424,7 @@ QWidget *lcQPropertiesTree::createEditor(QWidget *parent, QTreeWidgetItem *item)
QLineEdit *editor = new QLineEdit(parent);
float value = item->data(0, PropertyValueRole).toFloat();
editor->setValidator(new QDoubleValidator());
editor->setValidator(new QDoubleValidator(editor));
editor->setText(lcFormatValueLocalized(value));
connect(editor, SIGNAL(returnPressed()), this, SLOT(slotReturnPressed()));

View file

@ -19,7 +19,11 @@ void lcDoInitialUpdateCheck()
{
QDateTime NextCheckTime = CheckTime.addDays(updateFrequency == 1 ? 1 : 7);
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
if (NextCheckTime > QDateTime::currentDateTimeUtc())
#else
if (NextCheckTime > QDateTime::currentDateTime())
#endif
return;
}
@ -147,7 +151,11 @@ void lcQUpdateDialog::replyFinished(QNetworkReply *reply)
else
ui->status->setText(tr("Error parsing update information."));
#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0))
settings.setValue("Updates/LastCheck", QDateTime::currentDateTimeUtc());
#else
settings.setValue("Updates/LastCheck", QDateTime::currentDateTime());
#endif
updateReply = NULL;
reply->deleteLater();