diff --git a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.cpp b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.cpp
index 6933c4a98..77e7305fd 100644
--- a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.cpp
+++ b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.cpp
@@ -51,6 +51,12 @@ BoardPostDisplayWidget::BoardPostDisplayWidget(const RsPostedPost& post,DisplayM
{
ui->setupUi(this);
setup();
+
+ ui->verticalLayout->addStretch();
+ ui->verticalLayout->setAlignment(Qt::AlignTop);
+ ui->topLayout->setAlignment(Qt::AlignTop);
+ ui->arrowsLayout->addStretch();
+ ui->arrowsLayout->setAlignment(Qt::AlignTop);
}
void BoardPostDisplayWidget::setCommentsSize(int comNb)
diff --git a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.ui b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.ui
index a1fe4b3e8..ce9cf74ae 100644
--- a/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.ui
+++ b/retroshare-gui/src/gui/Posted/BoardPostDisplayWidget.ui
@@ -7,11 +7,11 @@
0
0
758
- 195
+ 190
-
+
0
0
@@ -22,433 +22,442 @@
-
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
-
-
-
-
-
-
-
-
-
- QLayout::SetMinimumSize
-
-
-
-
+
+
+
+ 0
+ 0
+
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
+
-
+
+
-
+
+
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Vote up
+
+
+
+
+
+
+ :/images/up-arrow.png:/images/up-arrow.png
+
+
+ true
+
+
+
+ -
+
+
+
+ 9
+
+
+
+ 0
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 0
+
+
+
+ Vote down
+
+
+
+
+
+ \/
+
+
+
+ :/images/down-arrow.png:/images/down-arrow.png
+
+
+ true
+
+
+
+
+
+ -
+
+
+ PictureLabel_compact
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
+
+
+
+ -
+
+
+ QLayout::SetMinimumSize
+
+
-
+
+
+ 5
+
+
+ 0
+
+
+ 6
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 50
+ false
+
+
+
+ Posted by
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Signed by
+
+
+ true
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ You eyes only
+
+
+ true
+
+
+
+ -
+
+
+
+ 24
+ 16777215
+
+
+
+ Qt::NoFocus
+
+
+ Toggle Message Read Status
+
+
+
+ :/images/message-state-unread.png:/images/message-state-unread.png
+
+
+ true
+
+
+ false
+
+
+ true
+
+
+
+ -
+
+
+ New
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Expanding
+
+
+
+ 70
+ 20
+
+
+
+
+ -
+
+
+ Comments
+
+
+
+ :/images/comments.png:/images/comments.png
+
+
+ Qt::ToolButtonTextBesideIcon
+
+
+ true
+
+
+
+ -
+
+
+ Share
+
+
+
+ :/images/share.png:/images/share.png
+
+
+ true
+
+
+
+ -
+
+
+ Expand
+
+
+
+
+
+
+ :/images/expand.png:/images/expand.png
+
+
+ true
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ Arial
+ 10
+ 75
+ true
+
+
+
+ This is a very very very very loooooooooooooooonnnnnnnnnnnnnnnnng title don't you think? Yes it is and should wrap around I hope
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
+
+
+ true
+
+
+ true
+
+
+ Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse
+
+
+
+ -
+
+
+ TextLabel
+
+
+ true
+
+
+ true
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ site
+
+
+ true
+
+
+
+ -
+
+
-
+
+
+ PictureLabel
+
+
+ true
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 268
+ 17
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- Vote up
-
-
-
-
-
-
- :/images/up-arrow.png:/images/up-arrow.png
-
-
- true
-
-
-
- -
-
-
-
- 9
-
-
-
- 0
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 0
-
-
-
- Vote down
-
-
-
-
-
- \/
-
-
-
- :/images/down-arrow.png:/images/down-arrow.png
-
-
- true
-
-
-
-
-
- -
-
-
- PictureLabel_compact
-
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
- QSizePolicy::MinimumExpanding
-
-
-
- 20
- 40
-
-
-
-
-
-
- -
-
-
- QLayout::SetMinimumSize
-
-
-
-
-
- 5
-
-
- 0
-
-
- 6
-
-
-
-
-
-
- 0
- 0
-
-
-
-
- 50
- false
-
-
-
- Posted by
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Signed by
-
-
- true
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- You eyes only
-
-
- true
-
-
-
- -
-
-
-
- 24
- 16777215
-
-
-
- Qt::NoFocus
-
-
- Toggle Message Read Status
-
-
-
- :/images/message-state-unread.png:/images/message-state-unread.png
-
-
- true
-
-
- false
-
-
- true
-
-
-
- -
-
-
- New
-
-
-
- -
-
+
Qt::Horizontal
-
- QSizePolicy::Expanding
-
- 70
+ 257
20
-
-
+
- Comments
-
-
-
- :/images/comments.png:/images/comments.png
-
-
- Qt::ToolButtonTextBesideIcon
-
-
- true
-
-
-
- -
-
-
- Share
-
-
-
- :/images/share.png:/images/share.png
-
-
- true
-
-
-
- -
-
-
- Expand
-
-
-
-
-
-
- :/images/expand.png:/images/expand.png
-
-
- true
-
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- Arial
- 10
- 75
- true
-
-
-
- This is a very very very very loooooooooooooooonnnnnnnnnnnnnnnnng title don't you think? Yes it is and should wrap around I hope
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
-
-
- true
-
-
- true
-
-
- Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse
-
-
-
- -
-
-
- TextLabel
-
-
- true
-
-
- true
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- site
-
-
- true
-
-
-
- -
-
-
-
-
-
- PictureLabel
+ TextLabel
true
+
+ Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse
+
-
-
+
Qt::Horizontal
- 268
- 17
+ 257
+ 20
-
-
-
-
-
- -
-
-
- QFrame::StyledPanel
-
-
- QFrame::Raised
-
-
-
-
-
-
- Qt::Horizontal
-
-
-
- 257
- 20
-
-
-
-
- -
-
-
- TextLabel
-
-
- true
-
-
- Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse
-
- -
-
-
- Qt::Horizontal
-
-
-
- 257
- 20
-
-
-
-
-
-
-
+
+
+
diff --git a/retroshare-gui/src/gui/Posted/PostedListWidgetWithModel.cpp b/retroshare-gui/src/gui/Posted/PostedListWidgetWithModel.cpp
index 3ae793b54..6373fa43a 100644
--- a/retroshare-gui/src/gui/Posted/PostedListWidgetWithModel.cpp
+++ b/retroshare-gui/src/gui/Posted/PostedListWidgetWithModel.cpp
@@ -87,36 +87,15 @@ void PostedPostDelegate::paint(QPainter * painter, const QStyleOptionViewItem &
BoardPostDisplayWidget w(post,mDisplayMode);
- //w.setMaximumWidth(mCellWidthPix);
- //w.setMinimumWidth(mCellWidthPix);
w.adjustSize();
-
- w.setFixedSize(cellSize(w.size()));
+ w.setFixedSize(option.rect.size());
QPixmap pixmap(option.rect.size());
-#ifdef SUSPENDED_CODE
- if((option.state & QStyle::State_Selected) && post.mMeta.mPublishTs > 0) // check if post is selected and is not empty (end of last row)
- pixmap.fill(QRgb(0xff308dc7)); // I dont know how to grab the backgroud color for selected objects automatically.
- else
-#endif
- pixmap.fill(QRgb(0x00f0f0f0)); // choose a fully transparent background
-
-#ifdef TESTING
- {
- QPainter W(&pixmap);
- QLinearGradient m_gradient(0,0,pixmap.width(),0);
- m_gradient.setColorAt(0.0, QRgb(0xff390e90));
- m_gradient.setColorAt(1.0, QRgb(0xff09feff));
- W.fillRect(pixmap.rect(), m_gradient);
-
- w.render(&W,QPoint(),QRegion(),QWidget::DrawChildren );// draw the widgets, not the background
- }
-#endif
+ pixmap.fill(QRgb(0x00f0f0f0)); // choose a fully transparent background
w.render(&pixmap,QPoint(0,0),QRegion(),QWidget::DrawChildren );// draw the widgets, not the background
- std::cerr << "PostedPostDelegate::paint(): w.size() = " << w.size() << std::endl;
#ifdef TODO
if(IS_MSG_UNREAD(post.mMeta.mMsgStatus) || IS_MSG_NEW(post.mMeta.mMsgStatus))
{
@@ -126,25 +105,17 @@ void PostedPostDelegate::paint(QPainter * painter, const QStyleOptionViewItem &
}
#endif
- // debug
- if(index.row()==0 && index.column()==0)
- {
- QFile file("yourFile.png");
- file.open(QIODevice::WriteOnly);
- pixmap.save(&file, "PNG");
- std::cerr << "Saved pxmap to png" << std::endl;
- }
+// // debug
+// if(index.row()==0 && index.column()==0)
+// {
+// QFile file("yourFile.png");
+// file.open(QIODevice::WriteOnly);
+// pixmap.save(&file, "PNG");
+// std::cerr << "Saved pxmap to png" << std::endl;
+// }
//std::cerr << "option.rect = " << option.rect.width() << "x" << option.rect.height() << ". fm.height()=" << QFontMetricsF(option.font).height() << std::endl;
painter->save();
-
- // Is this necessary?
- //
- // painter->setRenderHint( QPainter::Antialiasing,true);
- // painter->setRenderHint( QPainter::TextAntialiasing,true);
- // painter->setRenderHint( QPainter::SmoothPixmapTransform,true);
- // painter->setRenderHint( QPainter::HighQualityAntialiasing,true);
-
painter->drawPixmap(option.rect.topLeft(), pixmap /*,.scaled(option.rect.width(),option.rect.width()*w.height()/(float)w.width(),Qt::KeepAspectRatio,Qt::SmoothTransformation)*/);
painter->restore();
}
@@ -159,20 +130,10 @@ QSize PostedPostDelegate::sizeHint(const QStyleOptionViewItem& option, const QMo
// This is the only place where we actually set the size of cells
RsPostedPost post = index.data(Qt::UserRole).value() ;
-
BoardPostDisplayWidget w(post,mDisplayMode);
- //w.setMinimumWidth(mCellWidthPix);
- //w.setMaximumWidth(mCellWidthPix);
-
w.adjustSize();
- QSize ss = cellSize(w.size());
-
- std::cerr << "PostedPostDelegate::sizeHint(): w =" << w.width() << " x " << w.height() << " new size = " << ss.width() << " x " << ss.height() ;
- w.setFixedSize(ss);
-
- std::cerr << " Final size:" << w.size() << std::endl;
return w.size();
}
@@ -184,12 +145,9 @@ QWidget *PostedPostDelegate::createEditor(QWidget *parent, const QStyleOptionVie
{
QWidget *w = new BoardPostDisplayWidget(post,mDisplayMode,parent);
- //w->setMinimumWidth(mCellWidthPix);
- //w->setMaximumWidth(mCellWidthPix);
w->adjustSize();
- w->setFixedSize(cellSize(w->size()));
+ w->setFixedSize(option.rect.size());
- std::cerr << "PostedPostDelegate::createEditor(): size = " << w->size() << std::endl;
return w;
}
else
@@ -208,7 +166,7 @@ PostedListWidgetWithModel::PostedListWidgetWithModel(const RsGxsGroupId& postedI
/* Invoke the Qt Designer generated object setup routine */
ui->setupUi(this);
- ui->postsTree->setModel(mPostedPostsModel = new RsPostedPostsModel());
+ ui->postsTree->setModel(mPostedPostsModel = new RsPostedPostsModel());
ui->postsTree->setItemDelegate(mPostedPostsDelegate = new PostedPostDelegate());
ui->postsTree->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); // prevents bug on w10, since row size depends on widget width
ui->postsTree->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);// more beautiful if we scroll at pixel level
@@ -281,11 +239,13 @@ void PostedListWidgetWithModel::switchDisplayMode()
{
whileBlocking(ui->cardViewButton)->setChecked(false);
mPostedPostsDelegate->setDisplayMode(BoardPostDisplayWidget::DISPLAY_MODE_COMPACT);
+ ui->postsTree->setUniformRowHeights(true);
}
else
{
whileBlocking(ui->classicViewButton)->setChecked(false);
mPostedPostsDelegate->setDisplayMode(BoardPostDisplayWidget::DISPLAY_MODE_CARD_VIEW);
+ ui->postsTree->setUniformRowHeights(false);
}
mPostedPostsModel->deepUpdate();