我有一个带有三个按钮的简单项目。
系统:Ubuntu 22.04 (Jammy Jellyfish) QEMU VM 我在其中运行具有 16 GB RAM 和六个内核的开发环境。
我运行代码:基于 Qt 6.2.3(GCC 10.3.1 20210422(Red Hat 10.3.1-1),64 位)
建立于 2022 年 5 月 23 日 01:17:57
来自修订版 ac1e86fe74
主机:Ubuntu 18.04(仿生海狸)64 GB RAM 12 核:
这是 mainwindow.cpp 文件的样子:
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow)
{
ui->setupUi(this);
animation1 = new QPropertyAnimation(ui->pushButton, "geometry");
animation1->setDuration(3000);
animation1->setStartValue(ui->pushButton->geometry());
animation1->setEndValue(QRect(50, 200, 100, 50));
animation1->start();
animation2 = new QPropertyAnimation(ui->pushButton_2, "geometry");
animation2->setDuration(3000);
animation2->setStartValue(ui->pushButton_2->geometry());
animation2->setEndValue(QRect(50, 200, 100, 50));
animation2->start();
animation3 = new QPropertyAnimation(ui->pushButton_3, "geometry");
animation3->setDuration(3000);
animation3->setStartValue(ui->pushButton_3->geometry());
animation3->setEndValue(QRect(50, 200, 100, 50));
animation3->start();
// Create Parallel Animation Croup
}
MainWindow::~MainWindow()
{
delete ui;
}
这是头文件mainwidow.h的样子:
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QPropertyAnimation>
//#include <QParallelAnimationGroup>
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
private:
Ui::MainWindow *ui;
QPropertyAnimation *animation1;
QPropertyAnimation *animation2;
QPropertyAnimation *animation3;
//QParallelAnimationGroup *animationGroup;
};
#endif // MAINWINDOW_H
一旦我取消注释标题中的第 6 行,我将在程序错误中得到 24498 个带有流浪'/*** 的问题:
我做错了什么?
/home/../project16/build-QParallelAnimationGroup-Desktop_Qt_6_2_4_GCC_64bit-Debug/QParallelAnimationGroup:1: error: stray ‘\177’ in program
In file included from ../QParallelAnimationGroup/mainwindow.h:6,
from ../QParallelAnimationGroup/mainwindow.cpp:1:
./QParallelAnimationGroup:1:1: error: stray ‘\177’ in program
1 | ELF > `5 @ @< @ 8 @ ) ( @ @ @ � � �* �* 0 0 0 � � ` ` ` � � �y �� �� � � | � � @ @ 8 8 8 0 0 h h h D D S�td 8 8 8 0 0 P�td �a �a �a Q�td R�td �y �� �� P P /lib64/ld-linux-x86-64.so.2 GNU � � � GNU �o�'!WQ��9C�49�MQ�G GNU i �@� i l ���|�e�mCE���qX ` r x � � � � � h � : e
| ^