Skip to content
  • 0 Votes
    4 Posts
    184 Views
    S

    bumping this up. Anyone can hint me how to mass paint controls?

  • 0 Votes
    8 Posts
    4k Views
    R

    @ChrisW67 Thanks ! The resizing works but screen.availableGeometry().size() is giving the incorrect size (much too big). I tried a variety of other ways but can't seem to get the correct available size even when running it after the widget is displayed using a timer as suggested.

  • 0 Votes
    5 Posts
    1k Views
    J

    @SGaist If forcing fusion style, it'll show the full list. But the style itself is very different. Fusion style has tick boxes and shows everything with no scrollbar I think.

  • Qt3 QListView to Qt5/6

    Unsolved General and Desktop
    4
    0 Votes
    4 Posts
    427 Views
    F

    Ok, ich found out that Qt3 QListView was intendet to be used as a List OR a Tree :-) https://doc.qt.io/archives/3.3/qlistview.html#details

    So maybe QTreeView/QTreeWidget is a good starting point now.

  • 0 Votes
    10 Posts
    813 Views
    H

    Yes this was it. Using an TableView will to the job.

  • 0 Votes
    4 Posts
    1k Views
    D

    In case anyone comes across this in a search, I was able to solve the problem by manipulating the selection in the class member function selectionChanged():

    https://bazaar.launchpad.net/~dlynch3/rapid/zeromq_pyqt/revision/1178#raphodo/thumbnaildisplay.py

    Perhaps that was always the best way to do it.

  • 0 Votes
    10 Posts
    868 Views
    T

    @Christian-Ehrlicher It caches entries that could have fairly high resolution images in them. 100MB consumed is quite reasonable for my particular use case. I've solved my problem my creating a general-purpose list model class which does not retain too many recent items in memory, and then implementing an application-specific subclass that will automatically produce small, low-resolution thumbnails and save them to a separate table to allow for faster loading later on.

  • Widget in a QListView

    Solved General and Desktop
    10
    0 Votes
    10 Posts
    2k Views
    coaxmetalC

    @mrjj Thanks for the newline example, but yeah, I am planning for some other requirements (coloring, custom arrangements, no-columns etc.)

  • 0 Votes
    1 Posts
    357 Views
    No one has replied
  • 0 Votes
    2 Posts
    474 Views
    SGaistS

    Hi,

    Did you already read the Using Drag and Drop with Item Views chapter in Qt's documentation ?

  • 0 Votes
    9 Posts
    3k Views
    J.HilkJ

    @AloyseTech IIRC hidePop() will reset the Popupwidget, so maybe hijack the add/remove process.
    Call hidePopup before adding are removing item and call showPopup afterwards?

  • 1 Votes
    3 Posts
    1k Views
    M

    @mrjj said in InternalMove for ListView not working in when view mode is IconMode:

    view->setMovement(QListView::Free);

    Yes, and the only difference this makes is apparently that the items can be dragged around to arbitrary positions, rather than snapping to a grid. This is not at all what I'm looking for.

    All I want is for the ListMode and IconMode to behave the same with regards to drag'n'drop, but the IconMode taking advantage of the horizontal space as well.

  • 0 Votes
    9 Posts
    2k Views
    B

    Thanks for the replies and apologies for the late response. I'm having a very busy period. I have in the meantime submitted a bug report: https://bugreports.qt.io/browse/QTBUG-73177

    @SGaist said in Heavy flickering in QListView when appending items if VerticalScrollBarPolicy == Qt::ScrollBarAlwaysOff:

    Qt 5.12.1 just got released, can you check again if you still have the same problem ?

    Yes, I did check 5.12.1 and nothing has changed. I've updated my bug report accordingly.

    @VRonin said in Heavy flickering in QListView when appending items if VerticalScrollBarPolicy == Qt::ScrollBarAlwaysOff:

    d_cancel is a race condition, change its type to std::atomic_bool
    What I suspect is happening is that this intersect check is not working correctly when you disable the scrollbars

    Thanks, I just wrote that little example code quickly and indeed, d_cancel could lead to problems (though not very likely). rest assured, in the actual project where I'm seeing this problem, the equivalent bool is already a std::atomic_bool.

    Thanks for the hint as to where the problem is, I will try to investigate.

    I have tried to install the debug packages of qt on my machine, but the easiest way to do so, they overwrite the normal packages and make my desktop unusable (since I'm running KDE which uses qt). So I need to figure out how to install a second, separate version or try to debug on a different (virtual) machine. Either way, just getting it set up will take more time than i have had lately. To be continued.

    Thanks again!

  • 0 Votes
    12 Posts
    5k Views
    T

    @steveq Thanks so much! Were u able to figure out how to make URLs, sandwiched between other text, clickable? e.g. if message was:

    Hey, checkout this website: http://forum.qt.io, its really cool!

    In that only the url should be click, and maybe show hover effect as well. I read some suggestions about using mouse hit-testing to achieve that, but it seems like a lot of work.

    Another thing I really wanted to do was to make text selectable, but even that seems complicated.

  • 0 Votes
    6 Posts
    2k Views
    P

    I updated the QT version to 5.11 and the problem goes away. No need to implement the leaveEvent of the QListView.
    Tested also with 5.10 and it worked there as well.

  • 1 Votes
    2 Posts
    1k Views
    No one has replied
  • 0 Votes
    2 Posts
    1k Views
    raven-worxR

    @payman
    i have no experience with accessibility on Linux. But maybe the following helps you:
    Qt Accessibility is based on AT-SPI via DBus on Unix/X11 and is tested to be working on Gnome and KDE.
    Are you sure that i3wm even supports accessibility?

  • 0 Votes
    5 Posts
    2k Views
    CybeXC

    @SGaist
    Platform - Linux x86_64
    Qt Version - 5.9.3

    @JNBarchan
    fontHeight produced a integer value +/- 56
    iconHeight produced an integer value ( < fontHeight)

    @VRonin
    The Role's where not the problem. Please see my updated delegate below (kudos for calling it, the delegate being the problem)

    Well this is embarrasing. I did not fully realize what I was coding until I had battled with the delegate all night.

    I understood that I was coding a template, and assumed that on each item which was added, the origin remained at [0,0]. This was not the case as there was an offset added of value specified in the sizeHint (in my case, 56). Thus all my QListView's QStandardItem's were in fact there, but drawn over each other.

    After changing values and experimenting over a long period (a number of hours), I finally came to the desired result, shown below.

    Also, I need to thank scopchanov for his hint into this offset problem

    StackoverFlow question as a reference

    Updated ServerDelegate.cpp

    #include "serverdelegate.h" ServerDelegate::ServerDelegate(QStyledItemDelegate *parent) : QStyledItemDelegate(parent) { fontCountry = QApplication::font(); fontCountry.setBold(true); fontCountry.setPointSize(QApplication::font().pointSize() + 3); fontCity = QApplication::font(); fontCity.setItalic(true); fontCity.setPointSize(QApplication::font().pointSize() - 1); } ServerDelegate::~ServerDelegate(){ } QSize ServerDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const{ Q_UNUSED(index) QSize totalCountrySize = Global::getCountryFlagFromCache(index.data(DataRole::CountryText).toString()).size(); QSize totalSideIcon = QPixmap(":/res/images/premium", "PNG").size(); QFontMetrics fmCountry(fontCountry); QFontMetrics fmCity(fontCity); int fontHeight = (2 * AppGlobal::Style_List_Seperator_Width) + (2 * AppGlobal::Style_List_Text_Item_Margin) + fmCountry.height() + fmCity.height(); int iconHeight = (2 * AppGlobal::Style_List_Seperator_Width) + (totalCountrySize.height() > totalSideIcon.height() ? totalCountrySize.height() : totalSideIcon.height()); int height = (fontHeight > iconHeight) ? fontHeight : iconHeight; int width = option.rect.width(); QSize size = QSize(width, height); return size; } void ServerDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const{ QStyledItemDelegate::paint(painter, option, index); QFontMetrics fmCountry(fontCountry); QFontMetrics fmCity(fontCity); QRect rec = option.rect; painter->save(); painter->setClipRect(rec); QString countryText = index.data(DataRole::CountryText).toString(); QString cityText = index.data(DataRole::CityText).toString(); QPixmap countryFlag = QPixmap(qvariant_cast<QPixmap>(index.data(DataRole::CountryFlag))); QPixmap sideIcon = qvariant_cast<QPixmap>(index.data(DataRole::SideIconFlag)); // Get a rectangle by size x, y. // With cooridinates [0,0]; [x,0]; [x,y]; [0,y] QRect topLine = option.rect, bottomLine = option.rect; // create top 'seperator' of X px's width, green in color; topLine.setTop(rec.top()); topLine.setLeft(rec.left()); topLine.setRight(rec.right()); topLine.setBottom(rec.top() + AppGlobal::Style_List_Seperator_Width); // 1px down painter->setPen(AppGlobal::Style_List_Seperator_Color); painter->fillRect(topLine, AppGlobal::Style_List_Seperator_Color); painter->drawRect(topLine); // create bottom 'seperator' of X px's width, green in color; bottomLine.setTop(rec.bottom() - AppGlobal::Style_List_Seperator_Width); bottomLine.setLeft(rec.left()); bottomLine.setRight(rec.right()); bottomLine.setBottom(rec.bottom()); // 1px down painter->setPen(AppGlobal::Style_List_Seperator_Color); painter->fillRect(bottomLine, AppGlobal::Style_List_Seperator_Color); painter->drawRect(bottomLine); // create background rectangle QRect content(rec.left(), topLine.bottom(), (rec.right() - rec.left()), (bottomLine.top() - topLine.bottom())); painter->setPen(AppGlobal::Style_List_Background_Color); painter->fillRect(content, ((option.state & QStyle::State_MouseOver) ? AppGlobal::Style_List_Hover_Color : AppGlobal::Style_List_Background_Color )); painter->drawRect(content); // create content rectangles from content container. QRect rectCountryFlag = content, rectSideIcon = content; // create country icon rectangle QSize countryFlagSize = countryFlag.size(); int cFPos = ((rectCountryFlag.bottom() - rectCountryFlag.top()) / 2) - (countryFlagSize.height() / 2) - 8; rectCountryFlag.setTop(rectCountryFlag.top() + cFPos); rectCountryFlag.setBottom(content.bottom() - cFPos); rectCountryFlag.setLeft(AppGlobal::Style_List_Left_Item_Margin - 8); rectCountryFlag.setRight(AppGlobal::Style_List_Left_Item_Margin + 16 + countryFlagSize.width()); painter->drawPixmap(rectCountryFlag, countryFlag); // create side icon rectangle QSize sideIconSize = sideIcon.size(); int siPos = ((rectSideIcon.bottom() - rectSideIcon.top()) / 2) - (sideIconSize.height() / 2) - 4; rectSideIcon.setTop(rectSideIcon.top() + siPos); rectSideIcon.setBottom(content.bottom() - siPos); rectSideIcon.setLeft(rec.width() - (AppGlobal::Style_List_Right_Item_Margin + 8 + sideIconSize.width())); rectSideIcon.setRight(rec.width() - AppGlobal::Style_List_Right_Item_Margin); painter->drawPixmap(rectSideIcon, sideIcon); int textContentLeft = rectCountryFlag.right() + AppGlobal::Style_List_Text_Item_Margin + AppGlobal::Style_List_Left_Item_Margin, textContentTop = content.top() + AppGlobal::Style_List_Text_Item_Margin; const QRect textContent( textContentLeft , textContentTop, (rectSideIcon.left() - AppGlobal::Style_List_Text_Item_Margin) - textContentLeft, (content.bottom() - AppGlobal::Style_List_Text_Item_Margin) - textContentTop); // create country text rectangle QRect rectCountryText = content, rectCityText = content; rectCountryText.setLeft(textContent.left()); rectCountryText.setTop(textContent.top()); rectCountryText.setRight(textContent.right()); rectCountryText.setBottom(textContent.top() + fmCountry.height()); painter->setPen(AppGlobal::Style_Heading_Color); painter->setFont(fontCountry); painter->drawText(rectCountryText, countryText); // create city text rectangle rectCityText.setLeft(textContent.left() + ( 2 * AppGlobal::Style_List_Text_Item_Margin)); rectCityText.setTop(rectCountryText.bottom()); rectCityText.setRight(textContent.right()); rectCityText.setBottom(textContent.bottom() + fmCity.height()); painter->setPen(AppGlobal::Style_SubText_Color); painter->setFont(fontCity); painter->drawText(rectCityText, cityText); // restore painter painter->restore(); }