| 22 | #include <QLayout> |
| 23 | |
| 24 | LocationBar::LocationBar(WebView *view, QWidget *parent) |
| 25 | : QLineEdit(parent) |
| 26 | , view_(view) |
| 27 | , focus_(false) |
| 28 | { |
| 29 | setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
| 30 | setStyleSheet("QLineEdit {margin-bottom: 1px; padding: 0px 3px 0px 3px;}"); |
| 31 | |
| 32 | QHBoxLayout *mainLayout = new QHBoxLayout(this); |
| 33 | mainLayout->setContentsMargins(0, 0, 0, 0); |
| 34 | mainLayout->setSpacing(0); |
| 35 | |
| 36 | rightWidget_ = new QWidget(this); |
| 37 | rightWidget_->resize(0, 0); |
| 38 | QHBoxLayout *rightLayout = new QHBoxLayout(rightWidget_); |
| 39 | rightLayout->setContentsMargins(0, 0, 2, 0); |
| 40 | |
| 41 | rssButton_ = new QToolButton(this); |
| 42 | rssButton_->setToolTip("RSS"); |
| 43 | rssButton_->setFocusPolicy(Qt::NoFocus); |
| 44 | rssButton_->setCursor(Qt::ArrowCursor); |
| 45 | rssButton_->setFocusPolicy(Qt::ClickFocus); |
| 46 | rssButton_->setStyleSheet("QToolButton { border: none; padding: 0px; }"); |
| 47 | QPixmap pixmap(":/images/feed"); |
| 48 | rssButton_->setIcon(QIcon(pixmap)); |
| 49 | rightLayout->addWidget(rssButton_, 0, Qt::AlignVCenter | Qt::AlignRight); |
| 50 | |
| 51 | mainLayout->addStretch(1); |
| 52 | mainLayout->addWidget(rightWidget_, 0, Qt::AlignVCenter | Qt::AlignRight); |
| 53 | |
| 54 | rssButton_->hide(); |
| 55 | |
| 56 | connect(rssButton_, SIGNAL(clicked()), this, SLOT(rssIconClicked())); |
| 57 | } |
| 58 | |
| 59 | void LocationBar::mouseReleaseEvent(QMouseEvent *event) |
| 60 | { |