1
0
mirror of git://projects.qi-hardware.com/qvido.git synced 2024-12-22 02:53:21 +02:00

add mouse movement

Signed-off-by: Mirko Lindner <mirko@sharism.cc>
This commit is contained in:
Mirko Lindner 2010-04-07 19:36:17 +02:00
parent f06a95726a
commit c4feb4a5b3
5 changed files with 56 additions and 5 deletions

View File

@ -115,9 +115,9 @@ void HtmlArea::setNewContent( int method, QString str = "" ){
log_debug("Text set");
// log_debug("index: " << article.getIndex());
// log_debug("enabled: " << this->isEnabled());
log_debug("string: " << str.toUtf8().data());
qApp->processEvents();
qobject_cast<QMain *>(this->parentWidget())->setEnabled(true);
log_debug("string: " << str.toUtf8().data());
}else{
this->setText(current);
@ -324,3 +324,40 @@ zim::Search::Results HtmlArea::searchArticleFromTitle(QString phrase)
log_debug("term :" << phrase.toUtf8().data());
return result;
}
///////////////////////////////////
// functions related to navigation
void HtmlArea::keyPressEvent(QKeyEvent *e){
log_debug("key pressed");
switch (e->key()) {
case Qt::Key_Right:
{
QPoint pos = qApp->overrideCursor()->pos();
qApp->overrideCursor()->setPos(pos.x() + 5, pos.y());
}
return;
case Qt::Key_Left:
{
QPoint pos = qApp->overrideCursor()->pos();
qApp->overrideCursor()->setPos(pos.x() - 5, pos.y());
}
return;
case Qt::Key_Down:
{
QPoint pos = qApp->overrideCursor()->pos();
qApp->overrideCursor()->setPos(pos.x(), pos.y() + 5);
}
return;
case Qt::Key_Up:
{
QPoint pos = qApp->overrideCursor()->pos();
qApp->overrideCursor()->setPos(pos.x(), pos.y() - 5);
}
return;
}
QTextBrowser::keyPressEvent(e);
}

View File

@ -52,6 +52,9 @@ class HtmlArea : public QTextBrowser
void setNewContent( int method, QString str );
QVariant loadResource(int type, const QUrl &name);
protected:
virtual void keyPressEvent(QKeyEvent *e);
public Q_SLOTS:
void linking( const QUrl &txt );
void sourceChange( const QUrl &txt );

View File

@ -1,7 +1,7 @@
/****************************************************************************
** Meta object code from reading C++ file 'htmlarea.h'
**
** Created: Wed Apr 7 18:36:22 2010
** Created: Wed Apr 7 19:01:42 2010
** by: The Qt Meta Object Compiler version 61 (Qt 4.5.2)
**
** WARNING! All changes made in this file will be lost!

View File

@ -1,7 +1,7 @@
/****************************************************************************
** Meta object code from reading C++ file 'qmain.h'
**
** Created: Wed Apr 7 18:36:22 2010
** Created: Wed Apr 7 19:01:42 2010
** by: The Qt Meta Object Compiler version 61 (Qt 4.5.2)
**
** WARNING! All changes made in this file will be lost!

View File

@ -23,6 +23,10 @@
#include <QMessageBox>
#include "qmain.h"
#include <cxxtools/log.h>
log_define("qvido.qmain");
QMain::QMain(std::string File)
{
@ -39,7 +43,14 @@ QMain::QMain(std::string File)
centralWidget,SLOT(linking(const QUrl&)));
QObject::connect(centralWidget,SIGNAL(sourceChanged(const QUrl &)),
centralWidget,SLOT(sourceChange(const QUrl&)));
QCursor cursor;
if (qApp->overrideCursor() == false){
qApp->setOverrideCursor(cursor);
log_debug("no cursor");
}
}
QMain::~QMain(){}
@ -84,7 +95,7 @@ void QMain::registerCommands()
connect(goToTopAct, SIGNAL(triggered()), this->centralWidget, SLOT(goToTop()));
this->addAction(goToTopAct);
// quit qvid0
// quit qvido
quitAct = new QAction(tr("Quit QVido"), this);
quitAct->setShortcut(tr("Ctrl+Q"));
quitAct->setStatusTip(tr("Quit"));