示例#1
0
MeshEditor::MeshEditor(SharedResources *shared, Editor *editor,
	QWidget *parent) : QWidget(parent)
{
	this->shared = shared;
	this->editor = editor;
	setFocusPolicy(Qt::StrongFocus);

	QVBoxLayout *columns = new QVBoxLayout(this);
	columns->setSizeConstraint(QLayout::SetMinimumSize);
	columns->setSpacing(0);
	columns->setMargin(0);

	QHBoxLayout *topRow = new QHBoxLayout();
	topRow->setSizeConstraint(QLayout::SetMinimumSize);
	topRow->setSpacing(0);
	topRow->setMargin(0);
	initTopRow(topRow);
	columns->addLayout(topRow);

	meshViewer = new MeshViewer(shared, this);
	columns->addWidget(meshViewer);

	QVBoxLayout *layout = new QVBoxLayout();
	layout->setMargin(10);
	layout->setSpacing(3);
	initFields(layout);
	columns->addLayout(layout);
	columns->addStretch(1);

	connect(this, SIGNAL(meshChanged(pg::Geometry)), meshViewer,
		SLOT(updateMesh(pg::Geometry)));
	connect(meshViewer, SIGNAL(ready()), this, SLOT(addMesh()));
}
示例#2
0
文件: widget.cpp 项目: ptrxyz/twmn
Widget::Widget(const char* wname) : m_settings(wname)//, m_shortcutGrabber(this, m_settings)
{
    setWindowFlags(Qt::ToolTip);
    setAttribute(Qt::WA_TranslucentBackground);
    setWindowOpacity(m_settings.get("gui/opacity").toInt() / 100.0);
    QPropertyAnimation* anim = new QPropertyAnimation(this);
    anim->setTargetObject(this);
    m_animation.addAnimation(anim);
    anim->setEasingCurve(QEasingCurve::Type(m_settings.get("gui/in_animation").toInt()));
    connect(anim, SIGNAL(finished()), this, SLOT(reverseTrigger()));
    connectForPosition(m_settings.get("gui/position").toString());
    connect(&m_visible, SIGNAL(timeout()), this, SLOT(reverseStart()));
    m_visible.setSingleShot(true);
    QHBoxLayout* l = new QHBoxLayout;
    l->setSizeConstraint(QLayout::SetNoConstraint);
    l->setMargin(0);
    l->setContentsMargins(0, 0, 0, 0);
    setLayout(l);
    l->addWidget(m_contentView["icon"] = new QLabel);
    l->addWidget(m_contentView["title"] = new QLabel);
    l->addWidget(m_contentView["text"] = new QLabel);
    m_contentView["title"]->setOpenExternalLinks(true);
    m_contentView["text"]->setOpenExternalLinks(true);
    setContextMenuPolicy(Qt::CustomContextMenu);
    connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onHide()));
    // Let the event loop run
    QTimer::singleShot(30, this, SLOT(init()));
}
示例#3
0
文件: main.cpp 项目: CodeDJ/qt5-hidpi
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QFileSystemModel model;
    QWidget window;
    QTreeView *tree = new QTreeView(&window);
    tree->setMaximumSize(1000, 600);

    QHBoxLayout *layout = new QHBoxLayout;
    layout->setSizeConstraint(QLayout::SetFixedSize);
    layout->addWidget(tree);

    window.setLayout(layout);
    model.setRootPath("");
    tree->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
    tree->setModel(&model);

    tree->setAnimated(false);
    tree->setIndentation(20);
    tree->setSortingEnabled(true);
    tree->header()->setStretchLastSection(false);

    window.setWindowTitle(QObject::tr("Dir View"));
    tree->header()->setSectionResizeMode(QHeaderView::ResizeToContents);

    window.show();

    return app.exec();
}
示例#4
0
void PositionSelector::init(bool fixedSize) {
    int w = qMax(((int)log10((double)rangeEnd))*10, 70);
    posEdit = new QLineEdit(this);
    posEdit->setObjectName("go_to_pos_line_edit");
    posEdit->setValidator(new U2LongLongValidator(rangeStart, rangeEnd, posEdit));
    if (fixedSize) {
        posEdit->setFixedWidth(w);
    } else {
        posEdit->setMinimumWidth(qMax(120, w));
    }
    posEdit->setAlignment(Qt::AlignRight);
    posEdit->setToolTip("Enter position here");
    connect(posEdit, SIGNAL(returnPressed()), SLOT(sl_onReturnPressed()));

    QHBoxLayout* l = new QHBoxLayout(this);
    if (fixedSize) {
        l->setContentsMargins(5, 0, 5, 0);
        l->setSizeConstraint(QLayout::SetFixedSize);
    } else {
        l->setMargin(0);
    }

    setLayout(l);
    
    if (dialog!=NULL) {
        QLabel* posLabel = new QLabel(tr("Position"), this);
        posLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
        l->addWidget(posLabel);
    }

    l->addWidget(posEdit);
}
示例#5
0
SpinSlider::SpinSlider(QString legend) 
    : value(0) 
{
    slider = new QSlider(Qt::Horizontal);
    slider->setRange(0, 100);
    slider->setFixedWidth(100);
    spinBox = new QSpinBox;
    spinBox->setRange(0, 100);
    spinBox->setSingleStep(1);
    QHBoxLayout* layout = new QHBoxLayout;
    if (! legend.isEmpty() ) {
        QLabel* label = new QLabel;
        label->setText(legend);
        layout->addWidget(label);
    }
    layout->addWidget(spinBox);
    layout->addWidget(slider);
    layout->setSizeConstraint(QLayout::SetFixedSize);
    layout->setMargin(0);
    setLayout(layout);

    connect(slider, SIGNAL(valueChanged(int)), spinBox, SLOT(setValue(int)));
    connect(spinBox, SIGNAL(valueChanged(int)), slider, SLOT(setValue(int)));
    connect(slider, SIGNAL(valueChanged(int)), 
            this, SLOT(setValue(int)));
    connect(spinBox, SIGNAL(valueChanged(int)), 
            this, SLOT(setValue(int)));
}
NetworkSelectionDialog::NetworkSelectionDialog(CoinQ::NetworkSelector& selector, QWidget* parent)
    : QDialog(parent)
{
    // Buttons
    QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok
                                     | QDialogButtonBox::Cancel);

    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

    // Network drop down
    QLabel* networkLabel = new QLabel();
    networkLabel->setText(tr("Choose network:"));
    networkBox = new QComboBox();
    populateNetworkBox(selector);

    QHBoxLayout* networkLayout = new QHBoxLayout();
    networkLayout->setSizeConstraint(QLayout::SetNoConstraint);
    networkLayout->addWidget(networkLabel);
    networkLayout->addWidget(networkBox);

    // Main Layout 
    QVBoxLayout *mainLayout = new QVBoxLayout();
    mainLayout->setSizeConstraint(QLayout::SetNoConstraint);
    mainLayout->addLayout(networkLayout);
    mainLayout->addWidget(buttonBox);
    setLayout(mainLayout);
}
示例#7
0
IsovalueWidget::IsovalueWidget(IsosurfaceEditor *isosurfaceEditor) : dataRangeSet(false)
{
  QHBoxLayout * layout = new QHBoxLayout();
  layout->setSizeConstraint(QLayout::SetMinimumSize);
  setLayout(layout);

  layout->addWidget(&isovalueCheckBox);

  // Isovalue slider, defaults to median value in range.
  isovalueSlider.setValue(int(0.5f * (isovalueSlider.minimum() + isovalueSlider.maximum())));
  isovalueSlider.setOrientation(Qt::Horizontal);

  layout->addWidget(&isovalueSlider);

  // Isovalue spin box.
  isovalueSpinBox.setDecimals(6);
  isovalueSpinBox.setValue(0.5f);
  layout->addWidget(&isovalueSpinBox);

  // Connect Q_SIGNALS and Q_SLOTS.
  connect(&isovalueCheckBox, SIGNAL(toggled(bool)), this, SLOT(apply()));
  connect(&isovalueSlider, SIGNAL(valueChanged(int)), this, SLOT(apply()));
  connect(&isovalueSpinBox, SIGNAL(valueChanged(double)), this, SLOT(apply()));

  connect(this, SIGNAL(isovalueChanged()), isosurfaceEditor, SLOT(apply()));
}
示例#8
0
QPushButton* SettingsDialog::addPathEdit(QString dir)
{
    if (amountPaths > maxAmountPaths) {
        showError(tr("Cannot add more than %1 paths").arg(maxAmountPaths));
        return NULL;
    }
    QHBoxLayout *hLayout = new QHBoxLayout();
    hLayout->setObjectName("pathLine");
    hLayout->setSizeConstraint(QHBoxLayout::SetMinimumSize);

    QLineEdit *lineEdit = new QLineEdit(dir);
    lineEdit->setMinimumHeight(25);
    lineEdit->setObjectName("path");
    if (!dir.isEmpty())
        lineEdit->setToolTip(dir);
    hLayout->addWidget(lineEdit);

    QPushButton *browseButton = new QPushButton(tr("Browse..."));
    browseButton->setMinimumHeight(28);
    hLayout->addWidget(browseButton);
    connect(browseButton, &QPushButton::clicked,
            lineEdit, [this, lineEdit]() {this->onBrowseButtonClicked(lineEdit);});

    QPushButton *minusButton = new QPushButton("-");
    minusButton->setMinimumHeight(28);
    minusButton->setMaximumWidth(28);
    minusButton->setObjectName("minusButton");
    hLayout->addWidget(minusButton);
    connect(minusButton, &QPushButton::clicked,
            hLayout, [this, hLayout]() {this->removeLine(hLayout);});

    ui->pathHolderLayout->addLayout(hLayout);
    amountPaths++;
    return browseButton;
}
示例#9
0
文件: mcmui.cpp 项目: OffieCao/MCM
void MCMui::initBtnInfo()
{
    btnWidget = new QWidget;
    refreshButton = new QPushButton(tr("手动刷新"));
    toStandbyButton = new QPushButton(tr("→停机状态"));
    toPrepareButton = new QPushButton(tr("→准备状态"));
    toStartButton = new QPushButton(tr("→启动状态"));
    toAdjustButton = new QPushButton(tr("→调节状态"));
    toWorkButton = new QPushButton(tr("→稳定状态"));
    toWashButton = new QPushButton(tr("→清洗状态"));
    toShutdownButton = new QPushButton(tr("→关机"));
    getDataIndexButton = new QPushButton(tr("查看需求指标"));
    getDataBaseButton = new QPushButton(tr("查看数据库"));
    QHBoxLayout *btnStateLayout = new QHBoxLayout;
    btnStateLayout->addWidget(refreshButton);
    btnStateLayout->addWidget(toStandbyButton);
    btnStateLayout->addWidget(toPrepareButton);
    btnStateLayout->addWidget(toStartButton);
    btnStateLayout->addWidget(toAdjustButton);
    btnStateLayout->addWidget(toWorkButton);
    btnStateLayout->addWidget(toWashButton);
    btnStateLayout->addWidget(toShutdownButton);
    QHBoxLayout *btnConsultLayout = new QHBoxLayout;
    btnConsultLayout->addSpacing(490);
    //btnConsultLayout->addStretch(1);
    btnConsultLayout->addWidget(getDataIndexButton);
    btnConsultLayout->addWidget(getDataBaseButton);
    btnConsultLayout->setSizeConstraint(QLayout::SetFixedSize);
    //btnConsultLayout->setSpacing(10);
    QVBoxLayout *btnLayout = new QVBoxLayout;
    btnLayout->addLayout(btnStateLayout);
    btnLayout->addLayout(btnConsultLayout);

    btnWidget->setLayout(btnLayout);
}
示例#10
0
void MainWindow::fillRoutesTableWidget(QTableWidget* routesTableWidget, int index) {
    routesTableWidget->clearContents();
    routesTableWidget->setRowCount(0);

    if(index == 0) {
        // сортировка по времени
        vvPaths = getSortedByTime(vvPaths);
    } else {
        // сортировка по стоимости
        vvPaths = getSortedByMoney(vvPaths);
    }

    routesTableWidget->setRowCount(vvPaths.size());

    qDebug() << "vvPaths.size: " << vvPaths.size();
    for(int i = 0; i < vvPaths.size(); i++) {
        std::vector<SearchParameters> path = vvPaths.at(i);

        int start = path.at(0).getStart();
        QString startStr = QString::fromStdString(CityMap::Instance().getPlaceById(start).getName());

        int finish = path.at(path.size() - 1).getFinish();
        QString finishStr = QString::fromStdString(CityMap::Instance().getPlaceById(finish).getName());

        int cost = getCost(path);
        QString costStr = QString::number(cost);

        QTime time = getTime(path);

        routesTableWidget->setItem(i, 0, new QTableWidgetItem(startStr));
        routesTableWidget->setItem(i, 1, new QTableWidgetItem(finishStr));
        routesTableWidget->setItem(i, 2, new QTableWidgetItem(costStr));
        routesTableWidget->setItem(i, 3, new QTableWidgetItem(time.toString()));

        QHBoxLayout* layout = new QHBoxLayout();
        layout->setMargin(0);

        QPushButton* btn1 = new QPushButton(QIcon(":/map/icons/road.png"), "");
        QPushButton* btn2 = new QPushButton(QIcon(":/routes/icons/Get-Info-icon.png"), "");

        layout->setSizeConstraint(QLayout::SetMaximumSize);

        btn1->setProperty("index", QVariant(i));
        btn2->setProperty("index", QVariant(i));

        layout->setSpacing(0);

        layout->addWidget(btn1);
        layout->addWidget(btn2);

        connect(btn1, SIGNAL(clicked()), this, SLOT(drawPath()));
        connect(btn2, SIGNAL(clicked()), this, SLOT(showFullInfo()));

        QWidget* widget = new QWidget();
        widget->setLayout(layout);

        routesTableWidget->setCellWidget(i, 4, widget);
    }
}
示例#11
0
NetworkSettingsDialog::NetworkSettingsDialog(const QString& host, int port, bool autoConnect, QWidget* parent)
    : QDialog(parent)
{
    // Buttons
    QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok
                                     | QDialogButtonBox::Cancel);

    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

    // Host
    QLabel* hostLabel = new QLabel();
    hostLabel->setText(tr("Host:"));
    hostEdit = new QLineEdit();
    hostEdit->setText(host);

    QHBoxLayout* hostLayout = new QHBoxLayout();
    hostLayout->setSizeConstraint(QLayout::SetNoConstraint);
    hostLayout->addWidget(hostLabel);
    hostLayout->addWidget(hostEdit);

    // Port
    QLabel* portLabel = new QLabel();
    portLabel->setText(tr("Port:"));
    portEdit = new QLineEdit();
    portEdit->setText(QString::number(port));

    QHBoxLayout* portLayout = new QHBoxLayout();
    portLayout->setSizeConstraint(QLayout::SetNoConstraint);
    portLayout->addWidget(portLabel);
    portLayout->addWidget(portEdit);

    // Auto connect on startup
    autoConnectCheckBox = new QCheckBox(tr("Automatically connect on startup"));
    autoConnectCheckBox->setChecked(autoConnect);

    // Main Layout 
    QVBoxLayout *mainLayout = new QVBoxLayout();
    mainLayout->setSizeConstraint(QLayout::SetNoConstraint);
    mainLayout->addLayout(hostLayout);
    mainLayout->addLayout(portLayout);
    mainLayout->addWidget(autoConnectCheckBox);
    mainLayout->addWidget(buttonBox);
    setLayout(mainLayout);
}
HitMapDisplayDialog::HitMapDisplayDialog(int height, HitMap& hitmap, QWidget *parent) :
    QDialog(parent)
{
    setWindowTitle(tr("HitMap Display"));

    displayWidget = new HitMapDisplayWidget(height, hitmap);
    QHBoxLayout* mainLayout = new QHBoxLayout();
    mainLayout->addWidget(displayWidget);
    mainLayout->setSizeConstraint(QLayout::SetFixedSize);

    setLayout(mainLayout);
}
示例#13
0
void MainWindow::addNewItem()
{
    // copied from ui_itemFrame.h
    QHBoxLayout *itemLayout = new QHBoxLayout();
    itemLayout->setObjectName(QString::fromUtf8("itemLayout"));
    itemLayout->setSizeConstraint(QLayout::SetFixedSize);
    QCheckBox *haveFoundCheckBox = new QCheckBox();
    haveFoundCheckBox->setObjectName(QString::fromUtf8("haveFoundCheckBox"));
    haveFoundCheckBox->setMinimumHeight(30);

    itemLayout->addWidget(haveFoundCheckBox);

    QLineEdit *amountBox = new QLineEdit();
    amountBox->setObjectName(QString::fromUtf8("amountBox"));
    amountBox->setMaximumSize(QSize(80, 16777215));
    amountBox->setMinimumHeight(38);
    amountBox->setMinimumWidth(100);

    itemLayout->addWidget(amountBox);

    QLineEdit *itemName = new QLineEdit();
    itemName->setObjectName(QString::fromUtf8("itemName"));
    itemName->setMinimumHeight(38);
    itemName->setMinimumWidth(300);

    itemLayout->addWidget(itemName);

    QSpacerItem *horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);

    itemLayout->addItem(horizontalSpacer);

    QPushButton *deleteButton = new QPushButton();
    deleteButton->setObjectName(QString::fromUtf8("deleteButton"));
    deleteButton->setText("Remove");
    deleteButton->setMinimumHeight(38);
    //deleteButton->setCenterButtons(false);

    itemLayout->addWidget(deleteButton);
    // end of copied from ui_itemFrame.h
    // Doesn't work atm?
    //QObject::connect(deleteButton, SIGNAL(clicked(QAbstractButton*)), haveFoundCheckBox, SLOT(deleteLater()));
    QObject::connect(deleteButton, SIGNAL(clicked()), amountBox, SLOT(deleteLater()));
    QObject::connect(deleteButton, SIGNAL(clicked()), itemName, SLOT(deleteLater()));
    QObject::connect(deleteButton, SIGNAL(clicked()), deleteButton, SLOT(deleteLater()));
    QObject::connect(deleteButton, SIGNAL(clicked()), haveFoundCheckBox, SLOT(deleteLater()));
    QObject::connect(deleteButton, SIGNAL(clicked()), itemLayout, SLOT(deleteLater()));
    QObject::connect(deleteButton, SIGNAL(clicked()), this,SLOT(itemWasRemoved()));
    ui->mainLayout->addLayout(itemLayout);
    widgetsize+=80; // in principle should also reduce when removing item, need to create a slot...
    ui->scrollAreaContents->setFixedHeight(widgetsize);
}
示例#14
0
void HoursWidget::createLayout()
{
    nameLabel->setFixedWidth(150);
    nameLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    leftHoursLabel->setSizePolicy(QSizePolicy::MinimumExpanding , QSizePolicy::Minimum);
    totalHoursLabel->setSizePolicy(QSizePolicy::MinimumExpanding , QSizePolicy::Minimum);
    QHBoxLayout *layout = new QHBoxLayout(this);
    layout->addWidget(nameLabel, 1);
    layout->addWidget(hoursSpinBox, 2);
    layout->addWidget(leftHoursLabel, 1);
    layout->addWidget(totalHoursLabel, 1);
    layout->setSizeConstraint(QLayout::SetMinimumSize);
    setLayout(layout);
}
示例#15
0
void PorkMarket::show_text(const QString &message)
{
    QStringList list = message.split("|",QString::SkipEmptyParts);

    QWidget* w = new QWidget();
    QVBoxLayout* vbl = new QVBoxLayout(w);

    QHBoxLayout* top = new QHBoxLayout(w);
    QDateTime current_date_time = QDateTime::currentDateTime();
    QString current_date = current_date_time.toString("yyyy-MM-dd hh:mm:ss");
    QLabel* lab_time = new QLabel(current_date);
    top->addWidget(lab_time);
    if(list.size()>3)
    {
      QLabel* lab_price = new QLabel("price:"+list[2]+"XPC");
      top->addWidget(lab_price);
    }
    vbl->addLayout(top);

    QLabel* lab_image = new QLabel;
    QImage  image;
    if(list.size()>1)
    image.loadFromData(QByteArray::fromBase64(list[1].toLatin1()));
    lab_image->setPixmap(QPixmap::fromImage(image));
    QLabel* lab_content = new QLabel(list[0]);
    lab_content->setAlignment(Qt::AlignLeft|Qt::AlignTop);
    lab_content->setMidLineWidth(600);
    lab_content->setWordWrap(true);

    QHBoxLayout* bottom = new QHBoxLayout(w);
    bottom->setSizeConstraint(QLayout::SetFixedSize);
    bottom->addWidget(lab_image);
    bottom->addWidget(lab_content);

    vbl->addLayout(bottom);
    vbl->setSizeConstraint( QLayout::SetFixedSize );
    w->setLayout(vbl);
    QListWidgetItem* lwi = new QListWidgetItem;

    lwi->setSizeHint( w->sizeHint() );
    ui->listWidget->addItem(lwi);
    ui->listWidget->setItemWidget(lwi, w);

    lwi->setData(4,QVariant(list[0]));
    lwi->setData(1,QVariant(list[1]));
    lwi->setData(5,QVariant(list[2]));
    lwi->setData(3,QVariant(list[3]));
    lwi->setData(2,QVariant(""));
}
QWidget* RenderSettingsWindow::create_horizontal_group(QWidget* widget1, QWidget* widget2)
{
    QWidget* group = new QWidget();

    QHBoxLayout* layout = new QHBoxLayout();
    group->setLayout(layout);

    layout->setMargin(0);
    layout->setSpacing(10);
    layout->setSizeConstraint(QLayout::SetFixedSize);

    layout->addWidget(widget1);
    layout->addWidget(widget2);

    return group;
}
void tst_QBoxLayout::sizeConstraints()
{
    QWidget *window = new QWidget;
    QHBoxLayout *lay = new QHBoxLayout;
    lay->addWidget(new QLabel("foooooooooooooooooooooooooooooooooooo"));
    lay->addWidget(new QLabel("baaaaaaaaaaaaaaaaaaaaaaaaaaaaaar"));
    lay->setSizeConstraint(QLayout::SetFixedSize);
    window->setLayout(lay);
    window->show();
    QApplication::processEvents();
    QSize sh = window->sizeHint();
    lay->takeAt(1);
    QVERIFY(sh.width() >= window->sizeHint().width() &&
            sh.height() >= window->sizeHint().height());

}
示例#18
0
文件: guitar.cpp 项目: lbaudouin/TabZ
Guitar::Guitar(QString name, QString fingers, QWidget *parent) : name_(name), fingers_(fingers),
    QFrame(parent)
{
    QVBoxLayout *vlayout = new QVBoxLayout(this);
    QHBoxLayout *hlayout = new QHBoxLayout();
    hlayout->setSizeConstraint(QLayout::SetMinimumSize);

    this->setFrameStyle(QFrame::Box);
    this->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
    //this->setMinimumSize(150,200);
    //this->setMaximumWidth(200);

    QLabel *label = new QLabel(" " + name_ + " ");
    label->setFrameStyle(QFrame::Box);
    label->setAlignment(Qt::AlignCenter);
    label->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);


    buttonClose_ = new QToolButton();
    buttonClose_->setIcon( this->style()->standardIcon(QStyle::SP_DialogCloseButton) );
    connect(buttonClose_,SIGNAL(clicked()),this,SLOT(pressClose()));

    buttonReduce_ = new QToolButton();
    //buttonReduce_->setIcon( this->style()->standardIcon(QStyle::SP_TitleBarShadeButton) );
    buttonReduce_->setCheckable(true);

    QIcon icon;
    icon.addPixmap( this->style()->standardIcon(QStyle::SP_TitleBarUnshadeButton).pixmap(16), QIcon::Normal, QIcon::On );
    icon.addPixmap( this->style()->standardIcon(QStyle::SP_TitleBarShadeButton).pixmap(16), QIcon::Normal, QIcon::Off );
    buttonReduce_->setIcon(icon);

    strings = new Strings(fingers_,this);

    connect(buttonReduce_,SIGNAL(toggled(bool)),strings,SLOT(setHidden(bool)));
    //connect(buttonReduce_,SIGNAL(toggled(bool)),this,SLOT(reduced(bool)));

    hlayout->addWidget(label);
    hlayout->addWidget(buttonReduce_);
    hlayout->addWidget(buttonClose_);

    vlayout->addLayout(hlayout);
    vlayout->addWidget(strings);
}
示例#19
0
PanelResourceInfo::PanelResourceInfo(QWidget *parent) : QFrame(parent) {
	QVBoxLayout *layoutTop = new QVBoxLayout(this);
	QVBoxLayout *layoutLabels = new QVBoxLayout();
	QHBoxLayout *layoutButtons = new QHBoxLayout();

	_buttonExportRaw = new QPushButton(tr("Save"), this);
	_buttonExportBMUMP3 = new QPushButton(tr("Export as MP3"), this);
	_buttonExportTGA = new QPushButton(tr("Export as TGA"), this);
	_buttonExportWAV = new QPushButton(tr("Export as WAV"),this);

	_labelName = new QLabel(tr("Resource name:"), this);
	_labelSize = new QLabel(tr("Size:"), this);
	_labelFileType = new QLabel(tr("File type:"), this);
	_labelResType = new QLabel(tr("Resource type:"), this);

	layoutLabels->addWidget(_labelName);
	layoutLabels->addWidget(_labelSize);
	layoutLabels->addWidget(_labelFileType);
	layoutLabels->addWidget(_labelResType);

	layoutButtons->addWidget(_buttonExportRaw);
	layoutButtons->addWidget(_buttonExportBMUMP3);
	layoutButtons->addWidget(_buttonExportTGA);
	layoutButtons->addWidget(_buttonExportWAV);
	layoutButtons->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding));

	layoutButtons->setSizeConstraint(QLayout::SetMinimumSize);

	layoutTop->addLayout(layoutLabels);
	layoutTop->addLayout(layoutButtons);

	layoutTop->setContentsMargins(0, 0, 0, 0);

	_buttonExportRaw->setVisible(false);
	_buttonExportBMUMP3->setVisible(false);
	_buttonExportTGA->setVisible(false);
	_buttonExportWAV->setVisible(false);

	QObject::connect(_buttonExportRaw, &QPushButton::clicked, this, &PanelResourceInfo::slotSave);
	QObject::connect(_buttonExportTGA, &QPushButton::clicked, this, &PanelResourceInfo::slotExportTGA);
	QObject::connect(_buttonExportBMUMP3, &QPushButton::clicked, this, &PanelResourceInfo::slotExportBMUMP3);
	QObject::connect(_buttonExportWAV, &QPushButton::clicked, this, &PanelResourceInfo::slotExportWAV);
}
示例#20
0
QWidget * KoZoomAction::createWidget(QWidget *parent)
{
    // create the custom widget only if we add the action to the status bar
    if (!qobject_cast<QStatusBar*>(parent))
        return QSelectAction::createWidget(parent);

    QWidget *group = new QWidget(parent);
    QHBoxLayout *layout = new QHBoxLayout(group);
    layout->setSizeConstraint(QLayout::SetFixedSize);
    layout->setMargin(0);
    layout->setSpacing(0);

    // this is wrong; createWidget() implies this is a factory method, so we should be able to be called
    // multiple times without problems.  The 'new' here means we can't do that.
    // TODO refactor this method to use connections instead of d-pointer members to communicate so it becomes reentrant.
    d->input = new KoZoomInput(group);
    regenerateItems( d->effectiveZoom, true );
    connect(d->input, SIGNAL(zoomLevelChanged(const QString&)), this, SLOT(triggered(const QString&)));
    layout->addWidget(d->input);

    d->slider = new QSlider(Qt::Horizontal);
    d->slider->setToolTip(QObject::tr("Zoom"));
    d->slider->setMinimum(0);
    d->slider->setMaximum(32);
    d->slider->setValue(16);
    d->slider->setSingleStep(1);
    d->slider->setPageStep(1);
    d->slider->setMinimumWidth(80);
    d->slider->setMaximumWidth(80);
    layout->addWidget(d->slider);

    if (d->specialButtons & AspectMode) {
        d->aspectButton = new QToolButton(group);
        d->aspectButton->setIcon(koIcon("zoom-pixels"));
        d->aspectButton->setIconSize(QSize(22,22));
        d->aspectButton->setCheckable(true);
        d->aspectButton->setChecked(true);
        d->aspectButton->setAutoRaise(true);
        d->aspectButton->setToolTip(QObject::tr("Use same aspect as pixels"));
        connect(d->aspectButton, SIGNAL(toggled(bool)), this, SIGNAL(aspectModeChanged(bool)));
        layout->addWidget(d->aspectButton);
    }
示例#21
0
RoutingInputWidget::RoutingInputWidget( MarbleModel* model, int index, QWidget *parent ) :
        QWidget( parent ), d( new RoutingInputWidgetPrivate( model, index, this ) )
{
    QHBoxLayout *layout = new QHBoxLayout( this );
    layout->setSizeConstraint( QLayout::SetMinimumSize );
    layout->setSpacing( 0 );
    layout->setMargin( 0 );
    layout->addWidget( d->m_lineEdit );
    layout->addWidget( d->m_removeButton );

    bool const smallScreen = MarbleGlobal::getInstance()->profiles() & MarbleGlobal::SmallScreen;
    if ( smallScreen ) {
        connect( d->m_lineEdit, SIGNAL(decoratorButtonClicked()), this, SLOT(openTargetSelectionDialog()) );
    } else {
        d->createMenu( this );
        connect(d->m_lineEdit, SIGNAL(decoratorButtonClicked()), this, SLOT(showMenu()));
    }

    connect( d->m_removeButton, SIGNAL(clicked()), this, SLOT(requestRemoval()) );
    connect( d->m_marbleModel->bookmarkManager(), SIGNAL(bookmarksChanged()),
             this, SLOT(reloadBookmarks()) );
    connect( d->m_marbleModel->positionTracking(), SIGNAL(statusChanged(PositionProviderStatus)),
             this, SLOT(updateCurrentLocationButton(PositionProviderStatus)) );
    connect( &d->m_placemarkRunnerManager, SIGNAL(searchResultChanged(QAbstractItemModel*)),
             this, SLOT(setPlacemarkModel(QAbstractItemModel*)) );
    connect( &d->m_reverseGeocodingRunnerManager, SIGNAL(reverseGeocodingFinished(GeoDataCoordinates,GeoDataPlacemark)),
             this, SLOT(retrieveReverseGeocodingResult(GeoDataCoordinates,GeoDataPlacemark)) );
    connect( d->m_lineEdit, SIGNAL(returnPressed()),
             this, SLOT(findPlacemarks()) );
    connect( d->m_lineEdit, SIGNAL(textEdited(QString)),
             this, SLOT(setInvalid()) );
    connect( &d->m_placemarkRunnerManager, SIGNAL(searchFinished(QString)),
             this, SLOT(finishSearch()) );
    connect( d->m_marbleModel->routingManager()->routeRequest(), SIGNAL(positionChanged(int,GeoDataCoordinates)),
             this, SLOT(updatePosition(int,GeoDataCoordinates)) );
    connect( &d->m_nominatimTimer, SIGNAL(timeout()),
             this, SLOT(reverseGeocoding()) );
    connect( this, SIGNAL(targetValidityChanged(bool)), this, SLOT(updateCenterButton(bool)) );
    updateCenterButton( hasTargetPosition() );

    d->adjustText();
}
void HintsConfigurationUiHandler::mainConfigurationWindowCreated(MainConfigurationWindow *mainConfigurationWindow)
{
	connect(mainConfigurationWindow, SIGNAL(destroyed()), this, SLOT(mainConfigurationWindowDestroyed()));

	connect(mainConfigurationWindow->widget()->widgetById("hints/advanced"), SIGNAL(clicked()), this, SLOT(showAdvanced()));

	connect(mainConfigurationWindow->widget()->widgetById("hints/showContent"), SIGNAL(toggled(bool)),
	mainConfigurationWindow->widget()->widgetById("hints/showContentCount"), SLOT(setEnabled(bool)));

	connect(mainConfigurationWindow->widget()->widgetById("toolTipClasses"), SIGNAL(currentIndexChanged(const QString &)),
		this, SLOT(toolTipClassesHighlighted(const QString &)));

	ConfigGroupBox *toolTipBox = mainConfigurationWindow->widget()->configGroupBox("Look", "Buddy List", "General");

	QWidget *configureHint = new QWidget(toolTipBox->widget());
	overUserConfigurationPreview = new QFrame(configureHint);
	QHBoxLayout *lay = new QHBoxLayout(overUserConfigurationPreview);
	lay->setMargin(10);
	lay->setSizeConstraint(QLayout::SetFixedSize);

	overUserConfigurationTipLabel = new QLabel(overUserConfigurationPreview);
	overUserConfigurationTipLabel->setTextFormat(Qt::RichText);
	overUserConfigurationTipLabel->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
	overUserConfigurationTipLabel->setContentsMargins(10, 10, 10, 10);

	lay->addWidget(overUserConfigurationTipLabel);

   	configureOverUserHint = new QPushButton(tr("Configure"));
	connect(configureOverUserHint, SIGNAL(clicked()), this, SLOT(showOverUserConfigurationWindow()));

	Buddy example = Buddy::dummy();

	if (!example.isNull())
		hint_manager->prepareOverUserHint(overUserConfigurationPreview, overUserConfigurationTipLabel, example);

	lay = new QHBoxLayout(configureHint);
	lay->addWidget(overUserConfigurationPreview);
	lay->addWidget(configureOverUserHint);

	toolTipBox->addWidgets(new QLabel(tr("Hint over buddy list: ")), configureHint);
}
示例#23
0
/*! Add to main part of dialog the Vertical Layouts ,insert them in a orizontal
		layout to form two column, set Vertical Layouts to 0 .
*/
void Dialog::endVLayout()
{
	if (!m_leftVLayout || !m_rightVLayout)
		return;
	m_isMainVLayout = false;

	QHBoxLayout *layout = new QHBoxLayout;
	layout->setMargin(m_layoutMargin);
	layout->setSpacing(m_layoutSpacing);
	layout->setSizeConstraint(QLayout::SetFixedSize);

	layout->addLayout(m_leftVLayout);
	layout->setAlignment(m_leftVLayout, Qt::AlignLeft);
	layout->addLayout(m_rightVLayout);
	layout->setAlignment(m_rightVLayout, Qt::AlignLeft);

	addLayout(layout);

	m_leftVLayout = 0;
	m_rightVLayout = 0;
}
示例#24
0
ConfigGroupBox *ConfigTab::configGroupBox(const QString &name, bool create)
{
	if (MyConfigGroupBoxes.contains(name))
		return MyConfigGroupBoxes[name];

	if (!create)
		return 0;

	QGroupBox *groupBox = new QGroupBox(name, MyMainWidget);
	QHBoxLayout *groupBoxLayout = new QHBoxLayout(groupBox);
	groupBoxLayout->setSizeConstraint(QLayout::SetMinimumSize);

	MyMainLayout->insertWidget(MyConfigGroupBoxes.count(), groupBox);

	ConfigGroupBox *newConfigGroupBox = new ConfigGroupBox(name, this, groupBox);
	MyConfigGroupBoxes[name] = newConfigGroupBox;

	groupBox->show();

	return newConfigGroupBox;
}
QLabel* AbstractStatisticsWidget::addStatisticLabel
(
    const QString& description,
    const QString& initialValue,
    const QString& toolTip
)
{
    QHBoxLayout* layout = new QHBoxLayout();
    layout->setContentsMargins(2, 2, 2, 2);

    QLabel* descriptionLabel = new QLabel(description);
    descriptionLabel->setAlignment(Qt::AlignRight);

    QLabel* valueLabel = new QLabel(QString("<b>%1</b>").arg(initialValue));

    valueLabel->setTextFormat(Qt::RichText);
    valueLabel->setAlignment(Qt::AlignLeft);

    layout->addWidget(descriptionLabel);
    layout->addWidget(valueLabel);
    layout->setSizeConstraint(QLayout::SetMinimumSize);

    QWidget* containerWidget = new QWidget();
    containerWidget->setLayout(layout);

    QListWidgetItem* item = new QListWidgetItem();
    item->setSizeHint(containerWidget->sizeHint());

    this->addItem(item);
    this->setItemWidget(item, containerWidget);

    if (!toolTip.isNull())
    {
        descriptionLabel->setToolTip(toolTip);
        valueLabel->setToolTip(toolTip);
    }

    return valueLabel;
}
QWidget* PathChooserDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
    Q_UNUSED(index)

    QTreeWidgetItem *item = tree_->currentItem();
    if (!item) {
        return NULL;
    }
    path_item_ = item;

    path_editor_ = new QWidget(parent);
    QHBoxLayout *hbox = new QHBoxLayout(path_editor_);
    path_editor_->setLayout(hbox);
    path_le_ = new QLineEdit(path_editor_);
    QPushButton *pb = new QPushButton(path_editor_);

    path_le_->setText(item->text(col_p_pipe_));
    pb->setText(QString(tr("Browse...")));

    hbox->setContentsMargins(0, 0, 0, 0);
    hbox->addWidget(path_le_);
    hbox->addWidget(pb);
    hbox->setSizeConstraint(QLayout::SetMinimumSize);

    // Grow the item to match the editor. According to the QAbstractItemDelegate
    // documenation we're supposed to reimplement sizeHint but this seems to work.
    QSize size = option.rect.size();
    size.setHeight(qMax(option.rect.height(), hbox->sizeHint().height()));
    item->setData(col_p_pipe_, Qt::SizeHintRole, size);

    path_le_->selectAll();
    path_editor_->setFocusProxy(path_le_);
    path_editor_->setFocusPolicy(path_le_->focusPolicy());

    connect(path_le_, SIGNAL(destroyed()), this, SLOT(stopEditor()));
    connect(pb, SIGNAL(pressed()), this, SLOT(browse_button_clicked()));
    return path_editor_;
}
示例#27
0
/*!	\fn TPixel32  DVGui::ColorField::getColor() const
		Return ColorField current color.
*/
ColorField::ColorField(QWidget *parent,
					   bool isAlphaActive,
					   TPixel32 color,
					   int squareSize,
					   bool useStyleEditor)
	: QWidget(parent), m_color(color), m_notifyEditingChange(true), m_useStyleEditor(useStyleEditor)
{
	setMaximumHeight(squareSize);
	QHBoxLayout *layout = new QHBoxLayout(this);
	layout->setMargin(0);
	layout->setSpacing(5);

	layout->setSizeConstraint(QLayout::SetFixedSize);

	int h = WidgetHeight;

	m_colorSample = new StyleSample(this, squareSize, squareSize);
	m_colorSample->setColor(m_color);
	m_redChannel = new ChannelField(this, QString("R:"), m_color.r);
	connect(m_redChannel, SIGNAL(valueChanged(int, bool)), SLOT(onRedChannelChanged(int, bool)));
	m_greenChannel = new ChannelField(this, QString("G:"), m_color.g);
	connect(m_greenChannel, SIGNAL(valueChanged(int, bool)), SLOT(onGreenChannelChanged(int, bool)));
	m_blueChannel = new ChannelField(this, QString("B:"), m_color.b);
	connect(m_blueChannel, SIGNAL(valueChanged(int, bool)), SLOT(onBlueChannelChanged(int, bool)));
	m_alphaChannel = new ChannelField(this, QString("M:"), m_color.m);
	connect(m_alphaChannel, SIGNAL(valueChanged(int, bool)), SLOT(onAlphaChannelChanged(int, bool)));

	layout->addWidget(m_colorSample);
	layout->addWidget(m_redChannel);
	layout->addWidget(m_greenChannel);
	layout->addWidget(m_blueChannel);
	layout->addWidget(m_alphaChannel);

	if (!isAlphaActive)
		m_alphaChannel->hide();
	setLayout(layout);
}
示例#28
0
QLayout *AboutDlg::initUserGuideLayout()
{
    // The user guide layout has a label (User Guide) and a PDF logo.

    guideLabel = new QLabel();
    guideLabel->setMaximumSize(112, 32);
    guideLabel->setAlignment(Qt::AlignCenter);

    QLabel * pdfLogo = new QLabel();
    pdfLogo->setMaximumSize(32, 32);
    pdfLogo->setPixmap(QPixmap(":/images/logo-pdf.png"));
    pdfLogo->setScaledContents(true);
    pdfLogo->setAlignment(Qt::AlignCenter);

    QHBoxLayout * userGuideLayout = new QHBoxLayout();
    userGuideLayout->setSizeConstraint(QLayout::SetMaximumSize);
    userGuideLayout->setSpacing(5);
	userGuideLayout->addSpacerItem(new QSpacerItem(100, 32, QSizePolicy::Maximum, QSizePolicy::Fixed));
    userGuideLayout->addWidget(guideLabel);
    userGuideLayout->addWidget(pdfLogo);
	userGuideLayout->addSpacerItem(new QSpacerItem(100, 32, QSizePolicy::Maximum, QSizePolicy::Fixed));

    return userGuideLayout;
}
示例#29
0
PicsSelectWidget::PicsSelectWidget(QWidget *parent, CubeDoc *document)
	:QWidget(parent), m_doc(document), m_bFinishedCreate(false), 
	m_currentGlobalCount(-1), m_currentBuildTilesCount(-1),
	m_bIncomingSignalsBlocked(false), m_nGblocked(0), m_nFblocked(0)
{
	m_layout = new QVBoxLayout;
	setLayout(m_layout);
	m_layout->setMargin(0);


	m_selectAllBot = new QPushButton("Set all to 1");
	m_selectAllBot->setMinimumSize(70, MIN_BOT_HEIGHT);
	m_selectNoneBot = new QPushButton("Select None");
	m_selectNoneBot->setMinimumSize(70, MIN_BOT_HEIGHT);

	m_slvPalette = new QPalette();
	m_slvPalette->setColor(QPalette::Active, QPalette::WindowText, Qt::white);
	m_slvPalette->setColor(QPalette::Inactive, QPalette::WindowText, Qt::white);
	m_slvPalette->setColor(QPalette::Active, QPalette::Window, QColor(100, 130, 255));
	m_slvPalette->setColor(QPalette::Inactive, QPalette::Window, QColor(100, 130, 255));

	m_solveLabel = new QLabel(""); // not added to the widget, LEAKED
	m_solveLabel->setFrameShadow(QFrame::Sunken);
	m_solveLabel->setFrameShape(QFrame::Panel);
	m_solveLabel->setMinimumSize(150, 10);
	m_solveLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
	m_solveLabel->setPalette(*m_slvPalette);
	updateSolveText(-1, -1);

	QLabel *cntText = new QLabel("Selected / Needed:");
	cntText->setMinimumSize(110, 10);
	cntText->setAlignment(Qt::AlignRight | Qt::AlignVCenter);

	m_countPalette = new QPalette();

	m_numLabel = new QLabel("");
	m_numLabel->setTextFormat(Qt::RichText);
	m_numLabel->setPalette(*m_countPalette);
	m_numLabel->setAutoFillBackground(true);
	m_numLabel->setFrameShadow(QFrame::Sunken);
	m_numLabel->setFrameShape(QFrame::Panel);
	m_numLabel->setMinimumSize(110, 10);
	//m_numLabel->setMaximumSize(80, 23);
	m_numLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
	QFont bf = m_numLabel->font();
	bf.setBold(true);
	bf.setPointSize(bf.pointSize() + 4);
	m_numLabel->setFont(bf);

	QLabel *setText = new QLabel(tr("Current tab sets:"));
	setText->setMinimumSize(110, 10);
	setText->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
	m_selectCurrent = new DataSpinBox(0);
	m_selectCurrent->setMaximumSize(45, 23);
	m_selectCurrent->setButtonSymbols(QAbstractSpinBox::PlusMinus);
	m_selectCurrent->setRange(-1, MAX_IDENTICAL_PIECES);
	m_selectCurrent->setSpecialValueText("X");

	QPushButton *back = new QPushButton(QIcon(":/images/buildview.png"), "Close");
	back->setMinimumSize(50, MIN_BOT_HEIGHT);

	QWidget *ctrl = new QWidget(this); // its needed that this would be a widget and not just a layout so that it won't shrink...
	QHBoxLayout *ctrlLayout = new QHBoxLayout;
	ctrlLayout->setSizeConstraint(QLayout::SetMinimumSize);
	ctrl->setLayout(ctrlLayout);
	m_layout->addWidget(ctrl);

	ctrlLayout->setSpacing(8);
	ctrlLayout->setMargin(9);

	ctrlLayout->addWidget(m_selectAllBot);
	ctrlLayout->addWidget(m_selectNoneBot);
//	ctrlLayout->addWidget(m_solveLabel);
	ctrlLayout->addWidget(cntText);
	ctrlLayout->addWidget(m_numLabel);
	ctrlLayout->addWidget(setText);
	ctrlLayout->addWidget(m_selectCurrent);
	ctrlLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Preferred));

	ctrlLayout->addWidget(back);

	connect(m_selectAllBot, SIGNAL(clicked()), this, SLOT(pressedGlobalAll()));
	connect(m_selectNoneBot, SIGNAL(clicked()), this, SLOT(pressedGlobalNone()));
	connect(m_selectCurrent, SIGNAL(dvalueChanged(int, int)), this, SLOT(changedTabBox(int)));
	connect(back, SIGNAL(clicked()), this, SIGNAL(switchToDesign()));

}
StreamPostWidget::StreamPostWidget(DATA::FbStreamPost *post, QWidget *parent) :
    QWidget(parent),
    m_post(post),
    m_triedBothIcons(false)
{



    m_nam = new QNetworkAccessManager(this);
    connect(m_nam,SIGNAL(finished(QNetworkReply*)),
            this, SLOT(gotNetworkReply(QNetworkReply*)));

    //this->setStyleSheet("background : white;");
    this->setAutoFillBackground(true);
    QPalette palette = this->palette();
    palette.setColor(QPalette::Background, Qt::white);
    setPalette(palette);


    QHBoxLayout *mainLayout = new QHBoxLayout();
    QFrame *f = new QFrame();
    f->setMinimumWidth(10);
    f->setFrameShape(QFrame::VLine);
    mainLayout->insertWidget(1,f);
    mainLayout->setSizeConstraint(QLayout::SetMinimumSize);
    m_contentLayout = new QVBoxLayout();
    m_contentLayout->setSizeConstraint(QLayout::SetMinimumSize);

    if (post->isFromUser())
        this->setWindowTitle(post->getPoster().getName());
    else
        this->setWindowTitle(post->getPage().getName());

    if (post->getMessage() != "" || (post->getTargetId().compare("") != 0))
    {
        QLabel *message = new QLabel();
        QString text = post->getMessage();
        if (post->getTargetId().compare("") != 0)
            text.prepend("-> " + post->getTarget().getName() + ": ");
        message->setText(UTIL::hyperLink(text));
        message->setTextInteractionFlags(Qt::TextBrowserInteraction);
        message->setWordWrap(true);
        message->setMinimumWidth(450);
        message->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
        connect(message, SIGNAL(linkActivated(QString)),
                this, SIGNAL(contentClicked(QString)));
        m_contentLayout->addWidget(message,0,Qt::AlignTop);
    }


    QString ageHtml = "<style type=\"text/css\">a { text-decoration: none; }</style>"
                      "<font style=\"font-size : 8pt;\">" +
                      UTIL::ageString(post->getCreatedTime()) + " ";
    if (post->getAttribution() != "" && !post->getAttribution().startsWith("via"))
        ageHtml.append("via ");
    ageHtml.append(post->getAttribution() + "</font>");

    QLabel *age = new QLabel(ageHtml);
    m_ageLineLayout = new QHBoxLayout();
    m_ageLineLayout->insertWidget(1,age,1);

    // Get the app icon, prefer the one in attachment if present
    if (post->getAttachment()->getIcon().toString() != "")
    {
        QNetworkRequest nr;
        nr.setUrl(post->getAttachment()->getIcon());
        QNetworkReply *reply = m_nam->get(nr);
        m_outstandingNetworkRequests.insert(reply, AppIcon);
    }
    else if (m_post->getAppInfo().getIconUrl() != "")
    {
        m_triedBothIcons = true;
        QNetworkRequest nr;
        nr.setUrl(QUrl(m_post->getAppInfo().getIconUrl()));
        QNetworkReply *reply = m_nam->get(nr);
        m_outstandingNetworkRequests.insert(reply, AppIcon);
    }



    if (!post->getAttachment()->isEmpty())
    {
        DATA::FbStreamAttachment *attachment = post->getAttachment();
        FbAttachmentWidget *aw = new FbAttachmentWidget(attachment);
        aw->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
        connect(aw, SIGNAL(userClickedUrl(QString)),
                this, SIGNAL(contentClicked(QString)));
        m_contentLayout->addWidget(aw);
    }

    m_contentLayout->addLayout(m_ageLineLayout,0);
    m_contentLayout->addStretch();
    m_contentLayout->addSpacing(10);


    GUI::FbCommentManager *manager = new FbCommentManager(m_post->getPostId(),
                                                          FbCommentManager::PostId,
                                                          m_post->getCommentList()->canRemove());
    manager->setMaximumHeight(400);

    QString fbObjectId = m_post->getPostId();
    GUI::FbLikeManager *likeManager = new FbLikeManager(fbObjectId, m_post->userLikes());
    connect(likeManager, SIGNAL(userChangedLike(bool)),
            this, SLOT(likeChanged(bool)));

    QHBoxLayout *hLayout = new QHBoxLayout();
    m_showAddCommentButton = new QToolButton();
    m_showAddCommentButton->setAutoFillBackground(true);
    palette = m_showAddCommentButton->palette();
    palette.setColor(QPalette::Button,QColor(82,110,166));
    m_showAddCommentButton->setPalette(palette);
    m_showAddCommentButton->setIcon(QIcon(":/uiImages/addComment_50_50.jpg"));
    m_showAddCommentButton->setIconSize(QSize(40,40));
    m_showAddCommentButton->setToolTip("Comment");
    connect(m_showAddCommentButton, SIGNAL(clicked()),
            manager, SLOT(showAddComment()));
    hLayout->addWidget(m_showAddCommentButton,0);

    m_likeButton = new QToolButton();
    this->likeChanged(m_post->userLikes());
    m_likeButton->setIconSize(QSize(40,40));

    connect(m_likeButton, SIGNAL(clicked()),
            likeManager, SLOT(toggleUserLikes()));
    hLayout->addWidget(m_likeButton,0);
    hLayout->addStretch(1);

    m_contentLayout->addLayout(hLayout,0);
    m_contentLayout->addWidget(likeManager,0);
    m_contentLayout->addWidget(manager,2);

    //manager->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
    mainLayout->insertLayout(2,m_contentLayout,1);
    setLayout(mainLayout);


    getPosterPixmap();

    QDesktopWidget *dw = QApplication::desktop();
    QRect r = dw->screenGeometry();
    move(r.width() - 240, 40);


}