我刚刚开始使用Qt库.我正在尝试使用以下标头编译我的第一个测试脚本:
#include <qwebview.h>
Run Code Online (Sandbox Code Playgroud)
但它不会编译:
g++ main.cpp -o run.main
main.cpp:2:22: error: qwebview.h: No such file or directory
main.cpp: In function ‘int main()’:
main.cpp:10: error: ‘QWebView’ was not declared in this scope
Run Code Online (Sandbox Code Playgroud)
我的Linux Kubuntu机器上安装了libs:
$ locate qwebview
/usr/include/qt4/Qt/qwebview.h
/usr/include/qt4/QtWebKit/qwebview.h
/usr/lib/qt4/plugins/designer/libqwebview.so
Run Code Online (Sandbox Code Playgroud)
我跑了ldconfig一次以确保(我认为)可以看到libs,但显然,这还不够.
如何设置我的机器以便我可以开始使用Qt编译软件?
在我的电脑上(Win7 32,VS2010 Ultimate)我想使用Qt Creator和Qt Visual Studio加入,两个LGPL版本.
在诺基亚网站上有minGW和VS2008版本的Qt框架,我没有找到VS 2010版本.
所以我安装了Qt 2010.05 SDK,并在VS 2010命令提示符下执行了以下步骤:
configure -static
nmake sub-src
Run Code Online (Sandbox Code Playgroud)
我检查了Qt Creator,它成功运行了.翻译完成后我安装了VS 2010添加我试图在路径中添加新的Qt版本
C:\Qt\2010.05\qt
Run Code Online (Sandbox Code Playgroud)
但是出现了以下错误消息:
给定路径中的Qt是使用minGW构建的
它不明白为什么因为翻译已经为VS2010执行了.
错误在哪里?如何正确安装?
我试图在插槽/信号设置的接收端获取几个类成员变量的信息,所以我想通过整个类.不幸的是,在传递了类之后,成员变量似乎是空的.这是一些代码片段:
这会设置通过课程的信号
signals:
void selected(const ControlIcon *controlIcon);
Run Code Online (Sandbox Code Playgroud)
这是插槽/信号连接
connect(controllerList->serialController, SIGNAL(selected(const ControlIcon*)),
infoView, SLOT(serialControllerSelected(const ControlIcon*)));
Run Code Online (Sandbox Code Playgroud)
我从要传递的类中发出信号
emit selected(this);
Run Code Online (Sandbox Code Playgroud)
这是调用类成员数据的代码
QLabel *ASCIIStringHolder = new QLabel;
ASCIIStringHolder->setText(controlIcon->m_ASCIIString);
Run Code Online (Sandbox Code Playgroud)
标签中没有显示任何内容,当我设置断点时,我可以看到内部没有任何内容m_ASCIIString.
我希望确保首先为它分配了一些文本,这不是问题所在.我还尝试了有无信号/插槽设置const.
任何帮助,将不胜感激.
我在 Qt 中遇到了另一个问题,我似乎无法弄清楚如何在带有QFile. 相反,一切都在开始时被擦除。那么根据给定的信息,我将如何写入特定行QFile?
这里有两个函数。
功能一
QString fileName = "C:\\Users\\Gabe\\SeniorProj\\Students.txt";
QFile mFile(fileName);
QTextStream stream(&mFile);
QString line;
int x = 1; //this counts how many lines there are inside the text file
QString currentID;
if(!mFile.open(QFile::ReadOnly | QFile::Text)){
qDebug() << "Could not open file for reading";
return;
}
do {
line = stream.readLine();
QStringList parts = line.split(";", QString::KeepEmptyParts);
if (parts.length() == 3) {
QString id = parts[0];
QString firstName = parts[1];
QString lastName = …Run Code Online (Sandbox Code Playgroud) 我差不多完成了我正在制作的玩具应用游戏.
问题: 我的通知总是显示我的计数器是30000.为什么不是时间减少?
我做了什么: 我已经实现了一个简单的Service类和一个自定义计时器来记下来.最终,一旦我确定计时器正在运行,我将退出整个游戏.
这是我的代码:
package com.example.redshirtmarblez;
import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.CountDownTimer;
import android.os.IBinder;
import android.widget.Toast;
public class TimingService extends Service{
public long counter = 30000;
private Context ctx;
private Activity localActivity;
private NotificationManager nm;
@Override
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
return null;
}
@Override
public void onCreate()
{
super.onCreate();
nm = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
declareNotification();
timer.start();
//Toast.makeText(this, "Timer is :" + counter, Toast.LENGTH_LONG).show();
//showNotification(); …Run Code Online (Sandbox Code Playgroud) android android-intent android-service android-notifications android-3.0-honeycomb
我希望有人能帮助我解决 Qt 设计师的问题。我正在尝试从调用 GUI 文件的类外部修改 GUI 元素。我已经设置了示例代码来显示我的程序的结构。func2我的目标是在主程序(或另一个类)中获取, 来更改主窗口的状态栏。
from PyQt4 import QtCore, QtGui
from main_gui import Ui_Main
from about_gui import Ui_About
#main_gui and about_gui are .py files generated by designer and pyuic
class StartQT4(QtGui.QMainWindow):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_Main()
self.ui.setupUi(self)
self.ui.actionMyaction.triggered.connect(self.func1)
#Signals go here, and call this class's methods, which call other methods.
#I can't seem to call other methods/functions directly, and these won't take arguments.
def func1(self):
#Referenced by the above code. Can interact …Run Code Online (Sandbox Code Playgroud) 我正在尝试在包含非拉丁字符的 Qt/C++ 软件上加载文件。一个用户报告的问题是俄罗斯文件名,我试图用下面的代码快速修复它。
示例文件名是(我不会读或写俄语!):??????? ???.dgr
bool QDepthmapView::loadFile(const QString &fileName)
{
m_open_file_name = fileName;
m_redraw_all = 1;
// this fixes the problem on a MacOSX but NOT on Windows!
QByteArray ba = fileName.toUtf8();
char *file = ba.data();
// end of fix
if(pDoc->OnOpenDocument(file)) // quick fix for weird chars (russian filename bug report)
{
// removed
}
return false;
}
Run Code Online (Sandbox Code Playgroud)
上面的修复是我在网上找到的一个快速的脏东西,它适用于我的 MacOSX10.8,但似乎 Windows 处理非 ASCII 字符有点不同,我不熟悉它。
我正在寻找用于加载非 ASCII 文件名的多平台解决方案(该软件在 Win、Mac 和 Linux 上运行)。
关于以下评论的编辑:
OnOpenDocument转到:
int QGraphDoc::OnOpenDocument(char* lpszPathName)
{
m_opened_name = …Run Code Online (Sandbox Code Playgroud) 为了将一个.js文件包含在另一个.js文件中,我尝试在文件中编写以下内容.js。
var head= document.getElementsByTagName('head')[0];
var script= document.createElement('script');
script.type= 'text/javascript';
script.src= 'helper.js';
head.appendChild(script);
Run Code Online (Sandbox Code Playgroud)
我得到了错误: ReferenceError: document is not defined
然后我写道:
<script type="text/javascript" charset="utf-8">
$(documuent).ready(function () { var editChange = $('td').replaceWith('<td id = "@Html.ValueFor(x => x.name)" >'); });
</script>
Run Code Online (Sandbox Code Playgroud)
在它的顶部,但得到了错误: SyntaxError: Unexpected token <
问题是这里不涉及浏览器。该.js文件正在运行QML并使用qmake.
这是什么语法?
我有两个PC和比特币-qt.在第一台PC上,我有一个用我的密码加密的钱包AAAAAAA,在我的第二台PC上,我有一个用其他密码加密的钱包BBBBBBBBB.我希望在我的第一台PC上拥有所有的btc,因为我想卖掉我的其他PC.
我知道我可以将我的btcs从第二台PC发送到第一台PC.但我更喜欢加入钱包.
我可以合并两个钱包吗?
我想在Qt for iOS中开发一个包含地图的应用程序.在使用过程中,应禁用手机的屏幕锁定.但我找不到任何解决方案如何使用Qt防止iOS中的屏幕锁定.
怎么办?