如何在 Qt C 中使用 QColordialog 保存颜色

发布于 2025-01-13 15:16:49 字数 380 浏览 4 评论 0原文

有人可以帮助解决这个问题,我在 QT c++ 广告中使用 QColorDialog 无法弄清楚如何保存所选颜色,因此在应用程序关闭然后重新启动后它会是相同的颜色。如果有帮助的话,我已经在此处包含了我的插槽,只要您将其关闭并重新启动,该应用程序就可以正常工作。

无效MainWindow::on_actionBackGround_Color_triggered()

{ QColor 颜色=QColorDialog::getColor(颜色);

      if (color.isValid()) {
          setPalette(QPalette(color));

{

{

感谢您的帮助,已经有一段时间了。

Can someone help with this problem,I am using the QColorDialog in QT c++ ad can't figure out how to save the selected color so it would be the same color after an app is shutdown and then restarted. I have included my slot here if it would help, the app work fine as long as you shut it off and restart it.

void MainWindow::on_actionBackGround_Color_triggered()

{
QColor color=QColorDialog::getColor(color);

      if (color.isValid()) {
          setPalette(QPalette(color));

{

{

Thanks for and help,it's been awhile.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文