From e0ecd611c99cf228d766eb9204af200fd14c34fe Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Tue, 6 May 2014 10:53:54 -0700 Subject: [PATCH] Better attachment styling. --- interface/src/ui/AttachmentsDialog.cpp | 8 ++++++-- interface/src/ui/AttachmentsDialog.h | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/interface/src/ui/AttachmentsDialog.cpp b/interface/src/ui/AttachmentsDialog.cpp index 2d28c51d7c..79b8d42f41 100644 --- a/interface/src/ui/AttachmentsDialog.cpp +++ b/interface/src/ui/AttachmentsDialog.cpp @@ -37,6 +37,7 @@ AttachmentsDialog::AttachmentsDialog() : container->setLayout(_attachments = new QVBoxLayout()); container->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred); area->setWidget(container); + _attachments->addStretch(1); foreach (const AttachmentData& data, Application::getInstance()->getAvatar()->getAttachmentData()) { addAttachment(data); @@ -55,14 +56,14 @@ AttachmentsDialog::AttachmentsDialog() : void AttachmentsDialog::updateAttachmentData() { QVector data; - for (int i = 0; i < _attachments->count(); i++) { + for (int i = 0; i < _attachments->count() - 1; i++) { data.append(static_cast(_attachments->itemAt(i)->widget())->getAttachmentData()); } Application::getInstance()->getAvatar()->setAttachmentData(data); } void AttachmentsDialog::addAttachment(const AttachmentData& data) { - _attachments->addWidget(new AttachmentPanel(this, data)); + _attachments->insertWidget(_attachments->count() - 1, new AttachmentPanel(this, data)); } static QDoubleSpinBox* createTranslationBox(AttachmentsDialog* dialog, float value) { @@ -86,7 +87,10 @@ static QDoubleSpinBox* createRotationBox(AttachmentsDialog* dialog, float value) } AttachmentPanel::AttachmentPanel(AttachmentsDialog* dialog, const AttachmentData& data) { + setFrameStyle(QFrame::StyledPanel); + QFormLayout* layout = new QFormLayout(); + layout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow); setLayout(layout); QHBoxLayout* urlBox = new QHBoxLayout(); diff --git a/interface/src/ui/AttachmentsDialog.h b/interface/src/ui/AttachmentsDialog.h index c23bd2efb8..663a831462 100644 --- a/interface/src/ui/AttachmentsDialog.h +++ b/interface/src/ui/AttachmentsDialog.h @@ -13,6 +13,7 @@ #define hifi_AttachmentsDialog_h #include +#include #include @@ -43,7 +44,7 @@ private: }; /// A panel controlling a single attachment. -class AttachmentPanel : public QWidget { +class AttachmentPanel : public QFrame { Q_OBJECT public: