Skip to content

Chinese

A forum for those speaking Chinese
714 Topics 1.8k Posts
  • Linux 4k分辨率下,创建多个openglwidget,会被系统kill掉。

    Unsolved
    4
    0 Votes
    4 Posts
    2k Views
    jiancaiyangJ
    可以呀,使用Qt Quick就可以完成你想要的效果,而且可以和OpenGL很好地整合起来。我目前做的产品,也就是基于这个思路。
  • 应用软件,只允许运行一次

    Unsolved
    3
    0 Votes
    3 Posts
    1k Views
    E
    m_bFirst = true; QString serverName = QCoreApplication::applicationName(); QLocalSocket socket; socket.connectToServer(serverName); if (socket.waitForConnected(500)) { m_bFirst = false; }else{ m_localServer = new QLocalServer(this); if (!m_localServer->listen(serverName)) { if (m_localServer->serverError() == QAbstractSocket::AddressInUseError && QFile::exists(m_localServer->serverName())) { QFile::remove(m_localServer->serverName()); m_localServer->listen(serverName); } } } m_bFirst为false,表示已经存在。 你可以试试先
  • 扩展窗口创建的问题

    Unsolved
    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • invokeMethod 的使用

    Unsolved
    2
    0 Votes
    2 Posts
    3k Views
    JKSHJ
    @Tegan 如果 func2 无返回值,那么您不应该使用 Q_RETURN_ARG。 请阅读 https://doc.qt.io/qt-5/qmetaobject.html#invokeMethod QString text = "Hello"; QMetaObject::invokeMethod(&myobj, "func2", Q_ARG(QString, text)); 从Qt 5.10开始,您也可以使用: // Function pointer QString msg; QMetaObject::invokeMethod(&myobj, &MyClass::func, &msg); qDebug() << "Return value:" << msg; // Lambda QMetaObject::invokeMethod(&myobj, [&myObj] { myObj.func2("Hello"); });
  • 关于BLE开发的问题

    Unsolved
    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • c++ 与 qml 交互

    Unsolved
    2
    0 Votes
    2 Posts
    2k Views
    joeQJ
    @neeme 你好,新年快乐。 方法1:什么时候使用,什么时候直接调用engine.rootContext()->setContextProperty("MAC", m1); // m2 方法2: C++环境可以使用两个变量吗? engine.rootContext()->setContextProperty("MAC_1", m1);
  • 请问QT5.9为什么不能在函数里创建对象呢?

    Unsolved
    4
    0 Votes
    4 Posts
    3k Views
    jiancaiyangJ
    是不是在strvec.h中忘记写了#endif?
  • 关于Qt读取MSSLQ中文资料乱码问题

    Unsolved
    1
    0 Votes
    1 Posts
    961 Views
    No one has replied
  • 请问怎样的同一个qml 文件中实现自定义的组件重用?

    Solved
    3
    0 Votes
    3 Posts
    2k Views
    neemeN
    但我怎样改变 t1.text 的值呢? 因为每个的值都不同
  • 0 Votes
    6 Posts
    4k Views
    SGaistS
    No, not at all. It's a translation specific question which in this case concerns both english and Chinese. However my answer still applies, overloading the changeEvent like described in the documentation is the correct thing to do: void MyWidget::changeEvent(QEvent *event) { if (event->type() == QEvent::LanguageChange) { titleLabel->setText(tr("Document Title")); ... okPushButton->setText(tr("&OK")); } else QWidget::changeEvent(event); } It's valid for all languages.
  • PostMessage发送WM_LBUTTONDOWN消息给QT窗口无效

    Solved
    7
    0 Votes
    7 Posts
    6k Views
    K
    问题已找到, 由于windows 10的uipi保护的问题, 目标进程的级别高于我的程序, 所以PostMessage失败了, GetLastError返回ERROR_ACCESS_DENIED。 解决办法需要提高自己的级别, menifest文件中设置uiAccess=true。
  • 图元指针数组移动产生的问题

    Solved
    3
    0 Votes
    3 Posts
    2k Views
    R
    最好使用C++风格,数组这个东西除非必要尽量不用的
  • 请问怎么做出这种倒影特效啊?

    Solved
    3
    0 Votes
    3 Posts
    2k Views
    jiancaiyangJ
    如果是Qt Quick的话,就非常简单,甚至有例子。
  • 大家好,有没有办法将GBK编码用16进制显示出来?

    Solved
    2
    0 Votes
    2 Posts
    1k Views
    H
    大家好 ,我找到办法了, 直接 return EncodeMethod->fromUnicode(resource).toHex(); 就行了。。
  • 0 Votes
    1 Posts
    1k Views
    No one has replied
  • 一个QGraphicsView对象对两个QGraphicsScene对象

    Solved
    3
    0 Votes
    3 Posts
    3k Views
    LimerL
    谢谢,我懂了。(凑出8个字)
  • 在creator 做UI 編輯時,為何菜單MenuBar 無法正常顯示?

    Unsolved
    4
    0 Votes
    4 Posts
    2k Views
    joeQJ
    @chinqan 我在我的电脑(macOS 10.11.6 Qt5.7.0)上做了测试,并没有发现显示异常。如果真的不方便,可以尝试其他版本的。
  • 获取绝对路径

    Unsolved
    8
    0 Votes
    8 Posts
    5k Views
    jiancaiyangJ
    @YiQin 方法的确有很多。QDir,QUrl,还有其它比如说QFileInfo等等,都可以达到效果,选择你认为最适合的吧。
  • QT QFontMetrics boundingRect failed to textwordwrap

    Unsolved
    7
    0 Votes
    7 Posts
    5k Views
    V
    @joeQ ,好的,非常感谢!
  • How to get the QRect size of MultiLine QString text that need display in multiple line?

    Unsolved
    2
    0 Votes
    2 Posts
    2k Views
    joeQJ
    @vitasr 您好! 相同类型的问题,发布一个即可。 随后,可以手动合并,删除一个。这个我就不替你修改。 原因已经在上一个帖子说明了,这里说下我的方法,仅供参考; 查分QString 为多个子串。split即可; 分别计算每个子串的QRect; 合并QRect=> QRect QRect::united(const QRect &rectangle) const 希望对您有所帮助。