• 支持语音与视频即时通讯项目杂记(二)


    目录

    概念:

    视频帧(Video Frame)是组成视频的基本单元。它可以被视为一幅静止的图像,它在一定的时间间隔内连续播放,从而形成了流畅的视频。

    Changes to Qt Multimedia

    New features in Qt 6

    Removed features

    Changed features

    qt6中的正则表达式校验的应用

    概念:

    视频帧(Video Frame)是组成视频的基本单元。它可以被视为一幅静止的图像,它在一定的时间间隔内连续播放,从而形成了流畅的视频。

    视频帧由像素组成,每个像素代表了图像中的一个点的颜色值。视频帧的大小通常以宽度和高度来描述,例如 1920x1080 表示宽度为 1920 像素,高度为 1080 像素。每个像素的颜色值可以通过不同的图像格式来表示,例如 RGB、YUV 等。

    视频帧之间的时间间隔称为帧率(Frame Rate),用于衡量每秒播放的视频帧数。常见的帧率有 24fps、30fps、60fps 等。较高的帧率可以提供更流畅的视频播放效果。

    理解帧的概念可以类比为一本动画书,每页都是一个静止画面,当您快速翻动这些画面时,就会产生连续的动画效果。同样地,视频帧也是以相似的方式运作,通过连续播放静止的视频帧,我们感知到了动态的视频内容。

    在视频处理和编辑中,您可以对视频帧进行各种操作,如剪辑、特效处理、颜色校正等。通过对视频帧的处理,可以实现视频的编辑、修复和增强等功能。

    总结起来,视频帧是组成视频的静止图像,通过连续播放这些图像,我们可以观看到流畅的动态视频内容。

    QVideoFrameQt Multimedia 模块中的一个类,用于表示视频帧的数据。它提供了处理和操作视频帧的功能。

    下面是 QVideoFrame 的一些常见用途和作用:

    1. 获取视频帧数据:通过 QVideoFrame,您可以获取视频帧的原始数据,包括像素数据、图像格式、图像大小等。这使得您可以进行视频处理、分析和编辑等操作。

    2. 格式转换:QVideoFrame 提供了方法将视频帧转换为不同的图像格式,以便与您的应用程序或其他模块兼容。您可以使用 QVideoFrame::map() 函数将帧数据映射到一个 QImage 或者 QPixmap 对象中,然后进行格式转换。

    3. 视频播放和显示:QVideoFrame 可以与其他 Qt 组件(如 QImageQLabelQGraphicsView 等)进行集成,实现视频的播放和显示。通过将视频帧数据与相应的图像组件结合使用,您可以在用户界面中实时显示视频。

    4. 视频输入输出:通过 QVideoFrame,您可以处理和传输视频帧数据。例如,您可以将视频帧保存为文件,或者从摄像头或其他视频源接收视频帧。

    综上所述,QVideoFrame 类提供了对视频帧的访问和处理功能,使您能够灵活地处理视频数据以满足应用程序的需求。

    在Qt项目中,.pri文件是一种特殊的文件类型,称为"包含文件"(Include File),主要用于将共享的构建设置和规则抽象成一个可复用的模块,方便在其他项目中重复使用。.pri文件可以包含编译器选项、头文件路径、库依赖关系以及其他自定义构建规则等信息。

    要创建一个.pri文件,您可以按照以下步骤操作:

    1. 打开Qt Creator,并且打开您要将.pri文件添加到的项目。

    2. 在项目视图中,右键单击您想要创建.pri文件的文件夹,选择"新建文件"(New File)。

    3. 在弹出的对话框中,选择"其他"(Other)-> "Pro 文件"(Pro File),然后点击下一步。

    4. 输入文件名并选择保存位置,例如:"myproject.pri",然后点击下一步。

    5. 在下一个对话框中,确认文件属性并且选择添加需要的模块或者库,并且可以在此处定义全局变量、宏定义、编译器选项等设置。然后点击完成来创建文件。

    6. 在您的项目文件(例如.pro文件)中包含该.pri文件:在您的项目文件中加入如下语句:

      include(myproject.pri)
      

    这样就可以在您的项目中使用.pri文件中定义的构建规则和设置了。需要注意的是,.pri文件中定义的变量或宏在引入该文件的项目中是全局可见的。因此,如果您有多个.pri文件,建议将它们放在独立文件夹中,以便管理和维护。

    官网中说明:

    Changes to Qt Multimedia

    Qt 6 is a result of the conscious effort to make the framework more efficient and easy to use.

    We try to maintain binary and source compatibility for all the public APIs in each release. But some changes were inevitable in an effort to make Qt a better framework.

    The module has been refactored significantly and has changed classification, from essential to add-on. The Qt Multimedia module in Qt 6 replaces the Qt Multimedia module from Qt 5.x. Existing code that uses Qt Multimedia from Qt 5 can be ported with limited effort.

    New features in Qt 6

    There are a number of new features in Qt Multimedia:

    • QMediaCaptureSession class is the central object for media capture.
    • QMediaRecorder class is now a class limited to recording audio and video. It handles encoding of data produced in a capture session.
    • Using QMediaFormat and QMediaRecorder, setting up the desired encoding when recording has changed significantly.
    • You can now also monitor the audio recorded by a capture session.
    • Support for selection of audio, video and subtitle tracks when playing back media files has been added.
    • QAudioDecoder is now supported on all platforms.

    Removed features

    Removed featureNotes or suggested alternative
    Playlist in QMediaPlayerQMediaPlayer does not do any playlist handling anymore in Qt 6.
    QMediaPlayListThis class has been removed from the API. It does however still exist as part of the Media Player Example.
    QAudioProbe and QVideoProbeThe audio and video probing API has been removed.
    QAudioRecorderUse the QMediaCaptureSession or CaptureSession QML type.
    Audio QML typeUse MediaPlayer QML type.
    QMediaObject and QMediaBindableInterfaceThese classes have been removed in favor of a more direct API for setting up connections between objects using, for example, setVideoOutput and QMediaCaptureSession.
    QCameraViewFinderSettingsThis class has been removed. Use QCameraFormat to define the resolution and frame rate the camera should be using.
    QMediaContentThe class has been removed. Use QUrl for individual media files instead.
    QSoundUse QSoundEffect instead.
    QVideoFilterRunnableUse shader effects in QML instead or access the QVideoFrame's content in C++.
    Public back-end APIThe back-end API of Qt Multimedia is private in Qt 6. This improves response time for supporting new multimedia use cases. Any classes that contain the words "Control" or "Abstract" in the class name in Qt 5 are now private in Qt 6.
    Back-end pluginsQt Multimedia in Qt 6 does not use a plugin infrastructure for its back ends anymore. This means that users no longer need to ship those back ends with their application. Instead, the back end being used is determined at compile time based on the underlying operating system. Qt uses gstreamer on Linux, WMF on Windows, AVFoundation on macOS and iOS and the Android multimedia APIs on Android.

    Changed features

    A number of classes previously offered in Qt Multimedia have changed in ways that may affect previously written code. The following table highlights these changes.

    Changed featureNotes
    Handling of Camera resolutions and frame ratesHandling of these has been simplified and a new QCameraFormat class helps with selecting the correct resolution and frame rate for the camera.
    Video output handling on the C++ side has changed significantly.QAbstractVideoSurface has been replaced by the QVideoSink class, and generic rendering support has been enhanced to cover all pixel formats supported by Qt Multimedia.
    Metadata typesQMediaMetaData has changed significantly: mainly moving from string based to enum based keys, and reducing the set of supported keys to the ones that can be supported on most platforms.
    QMediaFormatHandling of formats for encoded media and the settings for the media recorder have changed significantly. Qt 5 provides a string-based API, a separated file format, and audio and video codecs into three classes. However, Qt 6 unifies the formats in the QMediaFormat class. Additional settings are directly specified in QMediaRecorder. Setting up file formats and codecs is now implemented with enums and no longer uses strings. This puts some limitations on the set of codecs that can be used, but helps provide a consistent cross-platform API.
    QCameraImageCapture renamed QImageCaptureNone
    Audio inputs and outputsQMediaPlayer and QMediaCaptureSession (and the corresponding QML types MediaPlayer and CaptureSession) are not connected to any audio devices by default. Explicitly connect them to a QAudioInput/AudioInput or QAudioOutput/AudioOutput to capture or play back audio.
    Capturing videoA capture session is by default not connected to a Camera. Connect it to a QCamera object (Camera item) to be able to capture video or still images.

    qt6中的正则表达式校验的应用

    项目中,涉及IP地址校验等需求,qt6 正则表达式和qt5有一定差异,见下面的代码

    1. #ifndef CLINEEDIT_H
    2. #define CLINEEDIT_H
    3. #include
    4. #include
    5. class QLabel;
    6. class QIPLineEdit : public QLineEdit
    7. {
    8. Q_OBJECT
    9. public:
    10. QIPLineEdit(QWidget *parent = 0);
    11. ~QIPLineEdit();
    12. void setText(const QString &strIP);
    13. QString text() const;
    14. protected:
    15. bool eventFilter(QObject *obj, QEvent *ev);
    16. int getIndex(QLineEdit *pEdit);
    17. bool isTextValid(const QString &strIP);
    18. private:
    19. QLineEdit *m_lineEidt[4];
    20. };
    21. /
    22. class QMacLineEdit : public QLineEdit
    23. {
    24. Q_OBJECT
    25. public:
    26. QMacLineEdit(QWidget *parent = 0);
    27. ~QMacLineEdit();
    28. void setText(const QString &strMac);
    29. QString text() const;
    30. protected:
    31. // void paintEvent(QPaintEvent *event);
    32. bool eventFilter(QObject *obj, QEvent *ev);
    33. int getIndex(QLineEdit *pEdit);
    34. bool isTextValid(const QString &strIP);
    35. private:
    36. QLineEdit *m_lineEidt[6];
    37. };
    38. class QIconLineEdit : public QLineEdit {
    39. Q_OBJECT
    40. public:
    41. QIconLineEdit(QWidget *parent = 0);
    42. ~QIconLineEdit();
    43. void SetIcon(const QPixmap &pixmap);
    44. private:
    45. QLabel *labelPixmap;
    46. };
    47. #endif // QIPLINEEDIT_H
    1. #include "clineedit.h"
    2. #include "ipvalidator.h"
    3. #include
    4. #include
    5. #include
    6. #include
    7. #include
    8. #include
    9. #include
    10. #include
    11. #include
    12. #include
    13. #include
    14. QIPLineEdit::QIPLineEdit(QWidget *parent)
    15. : QLineEdit(parent)
    16. {
    17. QRegularExpression rx("(25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})");
    18. //QRegExp rx("(25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})");
    19. QHBoxLayout *pHBox = new QHBoxLayout(this);
    20. pHBox->setSpacing(2);
    21. pHBox->setContentsMargins(2, 2, 2, 2);
    22. QLabel *labelDot[3];
    23. for (int i = 0; i < 4; i++)
    24. {
    25. m_lineEidt[i] = new QLineEdit(this);
    26. m_lineEidt[i]->setProperty("ip", true);
    27. m_lineEidt[i]->setFrame(false);
    28. m_lineEidt[i]->setMaxLength(3);
    29. m_lineEidt[i]->setAlignment(Qt::AlignCenter);
    30. m_lineEidt[i]->installEventFilter(this);
    31. //m_lineEidt[i]->setValidator(new QRegExpValidator(rx, this));
    32. m_lineEidt[i]->setValidator(new IPValidator(this));
    33. m_lineEidt[i]->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
    34. pHBox->addWidget(m_lineEidt[i]);
    35. if (i < 3) {
    36. labelDot[i] = new QLabel(this);
    37. labelDot[i]->setText(".");
    38. labelDot[i]->setFixedWidth(2);
    39. pHBox->addWidget(labelDot[i]);
    40. }
    41. }
    42. this->setReadOnly(true);
    43. m_lineEidt[0]->setFocus();
    44. m_lineEidt[0]->selectAll();
    45. }
    46. QIPLineEdit::~QIPLineEdit()
    47. {
    48. }
    49. // 获取当前输入框索引
    50. int QIPLineEdit::getIndex(QLineEdit *pEdit)
    51. {
    52. int index = -1;
    53. for (int i = 0; i < 4; i++)
    54. {
    55. if (pEdit == m_lineEidt[i])
    56. index = i;
    57. }
    58. return index;
    59. }
    60. // 事件过滤器,判断按键输入
    61. bool QIPLineEdit::eventFilter(QObject *obj, QEvent *ev)
    62. {
    63. if (children().contains(obj) && QEvent::KeyPress == ev->type())
    64. {
    65. QKeyEvent *keyEvent = dynamic_cast(ev);
    66. QLineEdit *pCurrentEdit = qobject_cast(obj);
    67. switch (keyEvent->key())
    68. {
    69. case Qt::Key_0:
    70. case Qt::Key_1:
    71. case Qt::Key_2:
    72. case Qt::Key_3:
    73. case Qt::Key_4:
    74. case Qt::Key_5:
    75. case Qt::Key_6:
    76. case Qt::Key_7:
    77. case Qt::Key_8:
    78. case Qt::Key_9:
    79. {
    80. QString strText = pCurrentEdit->text();
    81. if (pCurrentEdit->selectedText().length())
    82. {
    83. pCurrentEdit->text().replace(pCurrentEdit->selectedText(), QChar(keyEvent->key()));
    84. }
    85. else if (strText.length() <=3 &&
    86. strText.toInt() * 10 > 255)
    87. {
    88. int index = getIndex(pCurrentEdit);
    89. if (index != -1 && index != 3)
    90. {
    91. m_lineEidt[index + 1]->setFocus();
    92. m_lineEidt[index + 1]->selectAll();
    93. }
    94. }
    95. else if (strText.length() == 2 && strText.toInt() * 10 < 255)
    96. {
    97. if (Qt::Key_0 == keyEvent->key() && strText.toInt())
    98. {
    99. pCurrentEdit->setText(strText.insert(pCurrentEdit->cursorPosition(),
    100. QChar(Qt::Key_0)));
    101. }
    102. }
    103. return QLineEdit::eventFilter(obj, ev);
    104. }
    105. break;
    106. case Qt::Key_Backspace:
    107. {
    108. QString strText = pCurrentEdit->text();
    109. if (strText.isEmpty())
    110. {
    111. int index = getIndex(pCurrentEdit);
    112. if (index != -1 && index != 0)
    113. {
    114. m_lineEidt[index - 1]->setFocus();
    115. int length = m_lineEidt[index - 1]->text().length();
    116. m_lineEidt[index - 1]->setCursorPosition(length ? length : 0);
    117. }
    118. }
    119. return QLineEdit::eventFilter(obj, ev);
    120. }
    121. case Qt::Key_Left:
    122. {
    123. if (!pCurrentEdit->cursorPosition())
    124. {
    125. int index = getIndex(pCurrentEdit);
    126. if (index != -1 && index != 0)
    127. {
    128. m_lineEidt[index - 1]->setFocus();
    129. int length = m_lineEidt[index - 1]->text().length();
    130. m_lineEidt[index - 1]->setCursorPosition(length ? length : 0);
    131. }
    132. }
    133. return QLineEdit::eventFilter(obj, ev);
    134. }
    135. case Qt::Key_Right:
    136. {
    137. if (pCurrentEdit->cursorPosition() == pCurrentEdit->text().length())
    138. {
    139. int index = getIndex(pCurrentEdit);
    140. if (index != -1 && index != 3)
    141. {
    142. m_lineEidt[index + 1]->setFocus();
    143. m_lineEidt[index + 1]->setCursorPosition(0);
    144. }
    145. }
    146. return QLineEdit::eventFilter(obj, ev);
    147. }
    148. // 小键盘的“.”号
    149. case Qt::Key_Period:
    150. {
    151. int index = getIndex(pCurrentEdit);
    152. if (index != -1 && index != 3)
    153. {
    154. m_lineEidt[index + 1]->setFocus();
    155. m_lineEidt[index + 1]->setCursorPosition(0);
    156. }
    157. return QLineEdit::eventFilter(obj, ev);
    158. }
    159. break;
    160. default:
    161. break;
    162. }
    163. }
    164. return false;
    165. }
    166. // 设置信息
    167. void QIPLineEdit::setText(const QString &strIP)
    168. {
    169. // 是否是IP地址
    170. if (!isTextValid(strIP))
    171. {
    172. QMessageBox::warning(this, "Attention",
    173. "Your IP Address is Invalid!",
    174. QMessageBox::StandardButton::Ok);
    175. return;
    176. }
    177. else
    178. {
    179. int i = 0;
    180. QStringList ipList = strIP.split(".");
    181. foreach (QString ip ,ipList)
    182. {
    183. m_lineEidt[i]->setText(ip);
    184. i++;
    185. }
    186. }
    187. }
    188. // 判断IP地址
    189. bool QIPLineEdit::isTextValid(const QString &strIP)
    190. {
    191. //QRegExp rx2("\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b");
    192. QRegularExpression rx2("\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b");
    193. QRegularExpressionMatch match = rx2.match(strIP);
    194. if (!match.hasMatch()) {
    195. return false;
    196. }
    197. // if (!rx2.exactMatch(strIP))
    198. // return false;
    199. return true;
    200. }
    201. // 获取IP地址
    202. QString QIPLineEdit::text() const
    203. {
    204. QString strIP;
    205. for (int i = 0; i < 4; i++) {
    206. strIP.append(m_lineEidt[i]->text());
    207. if (3 != i) {
    208. strIP.append(".");
    209. }
    210. }
    211. return strIP;
    212. }
    213. QMacLineEdit::QMacLineEdit(QWidget *parent)
    214. : QLineEdit(parent)
    215. {
    216. //QRegExp rx("([0-9A-Fa-f]{2})");
    217. QRegularExpression rx("([0-9A-Fa-f]{2})");
    218. QHBoxLayout *pHBox = new QHBoxLayout(this);
    219. pHBox->setSpacing(2);
    220. pHBox->setContentsMargins(2, 2, 2, 2);
    221. QLabel *labelDot[5];
    222. for (int i = 0; i < 6; i++)
    223. {
    224. m_lineEidt[i] = new QLineEdit(this);
    225. m_lineEidt[i]->setFrame(false);
    226. m_lineEidt[i]->setMaxLength(2);
    227. m_lineEidt[i]->setAlignment(Qt::AlignCenter);
    228. m_lineEidt[i]->installEventFilter(this);
    229. //m_lineEidt[i]->setValidator(new QRegExpValidator(rx, this));
    230. //m_lineEidt[i]->setValidator(new QValidator (0,100,this));
    231. QRegularExpressionValidator* validator = new QRegularExpressionValidator(QRegularExpression("(25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})"), this);
    232. m_lineEidt[i]->setValidator(validator);
    233. m_lineEidt[i]->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
    234. pHBox->addWidget(m_lineEidt[i]);
    235. if (i < 5) {
    236. labelDot[i] = new QLabel(this);
    237. labelDot[i]->setText("-");
    238. labelDot[i]->setFixedWidth(2);
    239. pHBox->addWidget(labelDot[i]);
    240. }
    241. }
    242. this->setReadOnly(true);
    243. m_lineEidt[0]->setFocus();
    244. m_lineEidt[0]->selectAll();
    245. }
    246. QMacLineEdit::~QMacLineEdit()
    247. {
    248. }
    249. int QMacLineEdit::getIndex(QLineEdit *pEdit)
    250. {
    251. int index = -1;
    252. for (int i = 0; i < 6; i++)
    253. {
    254. if (pEdit == m_lineEidt[i])
    255. index = i;
    256. }
    257. return index;
    258. }
    259. //
    260. bool QMacLineEdit::eventFilter(QObject *obj, QEvent *ev)
    261. {
    262. if (children().contains(obj) && QEvent::KeyPress == ev->type())
    263. {
    264. QKeyEvent *keyEvent = dynamic_cast(ev);
    265. QLineEdit *pCurrentEdit = qobject_cast(obj);
    266. switch (keyEvent->key())
    267. {
    268. case Qt::Key_0:
    269. case Qt::Key_1:
    270. case Qt::Key_2:
    271. case Qt::Key_3:
    272. case Qt::Key_4:
    273. case Qt::Key_5:
    274. case Qt::Key_6:
    275. case Qt::Key_7:
    276. case Qt::Key_8:
    277. case Qt::Key_9:
    278. case Qt::Key_A:
    279. case Qt::Key_B:
    280. case Qt::Key_C:
    281. case Qt::Key_D:
    282. case Qt::Key_E:
    283. case Qt::Key_F:
    284. {
    285. QString strText = pCurrentEdit->text();
    286. if (pCurrentEdit->selectedText().length())
    287. {
    288. pCurrentEdit->text().replace(pCurrentEdit->selectedText(),
    289. QChar(keyEvent->key()).toUpper());
    290. }
    291. else if (strText.length() == 2) {
    292. int index = getIndex(pCurrentEdit);
    293. if (0 <= index && index < 5)
    294. {
    295. m_lineEidt[index + 1]->setFocus();
    296. m_lineEidt[index + 1]->selectAll();
    297. }
    298. }
    299. return QLineEdit::eventFilter(obj, ev);
    300. }
    301. break;
    302. case Qt::Key_Backspace:
    303. {
    304. QString strText = pCurrentEdit->text();
    305. if (strText.isEmpty())
    306. {
    307. int index = getIndex(pCurrentEdit);
    308. if (index != -1 && index != 0)
    309. {
    310. m_lineEidt[index - 1]->setFocus();
    311. int length = m_lineEidt[index - 1]->text().length();
    312. m_lineEidt[index - 1]->setCursorPosition(length ? length : 0);
    313. }
    314. }
    315. return QLineEdit::eventFilter(obj, ev);
    316. }
    317. case Qt::Key_Period:
    318. {
    319. int index = getIndex(pCurrentEdit);
    320. QString strText = pCurrentEdit->text();
    321. if (strText.length() == 1) {
    322. pCurrentEdit->setText(strText.insert(0, QChar(Qt::Key_0)));
    323. }
    324. else if (strText.length() == 0) {
    325. pCurrentEdit->setText("00");
    326. }
    327. if (index != -1 && index < 5)
    328. {
    329. m_lineEidt[index + 1]->setFocus();
    330. m_lineEidt[index + 1]->setCursorPosition(0);
    331. }
    332. return QLineEdit::eventFilter(obj, ev);
    333. }
    334. break;
    335. default:
    336. break;
    337. }
    338. }
    339. return false;
    340. }
    341. //
    342. void QMacLineEdit::setText(const QString &strMac)
    343. {
    344. if (!isTextValid(strMac))
    345. {
    346. QMessageBox::warning(this, "Attention",
    347. "Your MAC Address is Invalid!",
    348. QMessageBox::StandardButton::Ok);
    349. return;
    350. }
    351. else
    352. {
    353. int i = 0;
    354. QStringList macList = strMac.split("-");
    355. foreach (QString mac ,macList)
    356. {
    357. m_lineEidt[i]->setText(mac);
    358. i++;
    359. }
    360. }
    361. }
    362. bool QMacLineEdit::isTextValid(const QString &strIP)
    363. {
    364. //qt6的写法
    365. QRegularExpression rx2("([0-9A-Za-z]{2})([0-9A-Za-z:-]{3}){5}");
    366. QRegularExpressionMatch match = rx2.match(strIP);
    367. return match.hasMatch();
    368. //qt5的写法
    369. //QRegExp rx2("([0-9A-Za-z]{2})([0-9A-Za-z:-]{3}){5}");
    370. // if (!rx2.exactMatch(strIP))
    371. // return false;
    372. // return true;
    373. }
    374. QString QMacLineEdit::text() const
    375. {
    376. QString strMac;
    377. for (int i = 0; i < 5; i++) {
    378. strMac.append(m_lineEidt[i]->text());
    379. if (3 != i) {
    380. strMac.append("-");
    381. }
    382. }
    383. return strMac;
    384. }
    385. QIconLineEdit::QIconLineEdit(QWidget *parent) :
    386. QLineEdit(parent)
    387. {
    388. labelPixmap = new QLabel(this);
    389. labelPixmap->setMinimumSize(16, 16);
    390. labelPixmap->setVisible(false);
    391. }
    392. QIconLineEdit::~QIconLineEdit()
    393. {
    394. }
    395. void QIconLineEdit::SetIcon(const QPixmap &pixmap)
    396. {
    397. if (pixmap.isNull()) return;
    398. labelPixmap->setPixmap(pixmap);
    399. labelPixmap->setVisible(true);
    400. labelPixmap->setGeometry(5,(this->height() - pixmap.height()) / 2, 16, 16);
    401. this->setTextMargins(25, 1, 1, 1);
    402. }

    ps:

    C++-CLION编写与调用DLL文件

  • 相关阅读:
    Mysql80服务无法启动请输入Net helpMsg3534以获得更多的帮助
    unity 血条跟随
    高精度加法(C语言实现)
    Hive文件存储格式和数据压缩
    小知识·Git常用命令
    【通过名称指定文件】小测验
    从零学习 InfiniBand-network架构(六)—IB协议链路层QoS如何实现
    程序员的编程格言
    嵌入式入门教学——模电基础概念
    同条网线电脑正常上网,手机连接wifi成功,但是无法访问互联网
  • 原文地址:https://blog.csdn.net/wh_xia_jun/article/details/133901237