Skip to content

Commit

Permalink
map icon with QTouchWeb page actions
Browse files Browse the repository at this point in the history
  • Loading branch information
penk committed Dec 30, 2010
1 parent d8ba2f1 commit 72f6d7f
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 7 deletions.
Binary file added skeleton/archive/qtouchweb/arrowleft.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added skeleton/archive/qtouchweb/arrowright.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added skeleton/archive/qtouchweb/delete.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed skeleton/archive/qtouchweb/fileclose.png
Binary file not shown.
34 changes: 27 additions & 7 deletions skeleton/archive/qtouchweb/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,15 @@ LineEdit::LineEdit(QWidget *parent)
: QLineEdit(parent)
{
clearButton = new QToolButton(this);
QPixmap pixmap("fileclose.png");
QPixmap pixmap("reload.png");
clearButton->setIcon(QIcon(pixmap));
clearButton->setIconSize(pixmap.size());
clearButton->setIconSize(QSize(16, 16));
clearButton->setCursor(Qt::ArrowCursor);
clearButton->setStyleSheet("QToolButton { border: none; padding: 0px; }");
clearButton->hide();

connect(clearButton, SIGNAL(clicked()), this, SLOT(clear()));
connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(updateCloseButton(const QString&)));

int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
setStyleSheet(QString("QLineEdit { padding-right: %1px; } ").arg(clearButton->sizeHint().width() + frameWidth + 1));
QSize msz = minimumSizeHint();
Expand Down Expand Up @@ -96,6 +97,7 @@ MainWindow::MainWindow()
progress = 0;

QNetworkProxyFactory::setUseSystemConfiguration(true);
setStyleSheet("QPushButton { border: none; padding: 5px; }");

view = new QWebView(this);
WebPage* page = new WebPage(view);
Expand All @@ -116,10 +118,23 @@ MainWindow::MainWindow()

QToolBar *toolBar = addToolBar(tr("Navigation"));
toolBar->setMovable(false);
toolBar->addAction(view->pageAction(QWebPage::Back));
toolBar->addAction(view->pageAction(QWebPage::Forward));

QPushButton *backBtn = new QPushButton(QPixmap("arrowleft.png"), "");
QAction *backAction = view->pageAction(QWebPage::Back);
connect(backBtn, SIGNAL(clicked()), backAction, SLOT(trigger()));

QPushButton *forwardBtn = new QPushButton(QPixmap("arrowright.png"), "");
QAction *forwardAction = view->pageAction(QWebPage::Forward);
connect(forwardBtn, SIGNAL(clicked()), forwardAction, SLOT(trigger()));

QPushButton *tabBtn = new QPushButton(QPixmap("plus.png"), "");
connect(tabBtn, SIGNAL(clicked()), this, SLOT(newWindow()));

toolBar->addWidget(backBtn);
toolBar->addWidget(forwardBtn);
toolBar->addWidget(locationEdit);
toolBar->addAction(view->pageAction(QWebPage::Reload));
toolBar->addWidget(tabBtn);
// toolBar->addAction(view->pageAction(QWebPage::Reload));

setCentralWidget(view);
}
Expand All @@ -129,6 +144,12 @@ void MainWindow::adjustLocation()
locationEdit->setText(view->url().toString());
}

void MainWindow::newWindow()
{
MainWindow* mw = new MainWindow();
mw->show();
}

void MainWindow::changeLocation()
{
QString string = locationEdit->text();
Expand All @@ -137,7 +158,6 @@ void MainWindow::changeLocation()
url = QUrl("http://" + string + "/");
locationEdit->setText(url.toEncoded());
view->load(url);

}

void MainWindow::adjustTitle()
Expand Down
3 changes: 3 additions & 0 deletions skeleton/archive/qtouchweb/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ class MainWindow : public QMainWindow
MainWindow();
QWebPage *webPage();

public slots:
void newWindow(); // const QString &url

protected slots:

void adjustLocation();
Expand Down
Binary file added skeleton/archive/qtouchweb/plus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added skeleton/archive/qtouchweb/reload.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 72f6d7f

Please sign in to comment.