我是 Java 的 QT 新手。 QT有没有类似的东西:https : //code.google.com/p/jnativehook/?我可以获得所有带有坐标的鼠标事件吗?我做了以下工作:
bool MainWindow::eventFilter(QObject *obj, QEvent *event)
{
if (event->type() == QEvent::MouseButtonRelease)
{
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
ui->listWidget->addItem(QString("Mouse pressed: %1,%2").arg(mouseEvent>pos().x()).arg(mouseEvent->pos().y()));
}
return false;
}
Run Code Online (Sandbox Code Playgroud)
这工作正常,但它只在我的应用程序内部而不是系统范围内。我该怎么做才能让它在 QT 中工作?此外,这只需要在 Windows 上运行...
在我的应用程序的开始我显示一个对话框.在这个对话框中,我有2个微调器.如果我更改第一个微调器的条目,则应用程序会加载JSON文件并将其解析为数据库.然后,微调器从保存JSON文件的数据库中填充SimpleCursorAdapter.问题是,当我更改第一个微调器时,它总是加载上次更改微调器时保存的数据库.
这是来自onItemSelected方法的代码:
final Handler handler = new Handler() {
public void handleMessage(Message msg) {
dialogs.dismiss();
}
};
Thread checkUpdate = new Thread() {
public void run() {
klassenListeAktualisieren((new Long(txtBerufID)).toString());
handler.sendEmptyMessage(0);
}
};
checkUpdate.start();
dbHelperKlasse = new KlassenlisteDbAdapter(myContext);
dbHelperKlasse.open();
Cursor cursor_Names = dbHelperKlasse.fetchAllOfThem();
startManagingCursor(cursor_Names);
String[] columns = new String[] { dbHelperKlasse.KEY_TITLE };
int[] to = new int[] { android.R.id.text1 };
SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(myContext, android.R.layout.simple_spinner_item,cursor_Names, columns, to);
mAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
klassenSpinner.setAdapter(mAdapter);
Run Code Online (Sandbox Code Playgroud)
如果您需要了解其他任何内容,请告诉我(代码等).
是否有可能更改Android选项卡,如果您按一个,它会到达TabHost的中心.只有3个标签可见,无论有多少.就像Android 4.0 Google音乐应用程序一样!如果是的话,你会怎么做?
谢谢!
我已经搜索了很长时间了...我正在编写一个应该兼容Android 2.2和Android 4.0的应用程序.由于在Android 4.0 Tabs被弃用,我想知道什么是正确的方法呢?如果我仍然在我的测试中使用Tabs它们看起来相当不错(所有大小相同,没有图标...)但是如果我然后在2.2上运行它们都看起来压在一起(只是每个标签的标题大小,也许与我使用HorizontalScrollView有关?)这里的正确决定是什么?只需使用Android 2.2和4.0的标签?如果是,我怎样才能将2.2上的选项卡设置为相同的大小?使用4.0上的片段和2.2上的选项卡?如果是,我将如何实现这一点?如果我应该使用Tabs我应该只使用4个标签(我有2到10个动态)并添加一个额外的"更多"标签?如果是,我该怎么做?
我希望这个问题是可以理解的.如果没有随意要求更多信息.
我在LinearLayout中有一个RelativeLayout,用于显示一些数据:
<LinearLayout
android:id="@+id/linearLayout4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="3dp"
android:layout_marginTop="3dp"
android:orientation="vertical" >
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:ellipsize="end"
android:maxLines="1"
android:textSize="16dp"
android:textStyle="bold" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:singleLine="true" />
<ImageView
android:id="@+id/uhr"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="left"
android:layout_marginLeft="2dp"
android:layout_toRightOf="@id/time"
android:src="@drawable/event_clock" />
</RelativeLayout>
<TextView
android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:autoLink="web|email"
android:textSize="14dp" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
问题是我想要我的ImageView在左边,TextView在它旁边.如果我android:layout_toRightOf="@id/time"改为android:layout_toLeftOf="@id/time"它只显示TextView但ImageView消失了.
对于我的应用程序,我需要一个带有远程图像的画廊(Gridview)(原始和拇指的URL被JSON文件解析),它显示缩略图,并在点击它加载原始大小的图像(异步将是最好的... )我已经在http://fukyo-it.blogspot.com/2010/08/iphone-sdk-creating-photo-gallery-with.html上看到了这款iPhone,但这在Android上如何轻松实现?
非常感谢帮助!
android ×5
android-4.0-ice-cream-sandwich ×1
android-tabs ×1
center ×1
gridview ×1
mouse-hook ×1
mouseevent ×1
qt ×1
tabs ×1
three20 ×1