Skip to content
QtWS25 Last Chance
  • 0 Votes
    8 Posts
    28k Views
    W
    @J.Hilk said in Set fixed margin/spacing/padding between Widgets/Layouts: @wrekler you have to set the margin and spacing of the QLayout item to 0 as well, not only in the StyleSheet. I believe those are 2 different pairs of shoes. @JonB said in Set fixed margin/spacing/padding between Widgets/Layouts: To clarify what @J-Hilk is saying (which I believe to be correct): a QLayout is not a QWidget and so cannot have its attributes affected via a stylesheet rule (sadly). That has to be done via explicit, back-end code. Here we go! That was the problem! Layout cannot be affected by a stylesheet file! Now I know how styling layout works! Thank!
  • 0 Votes
    3 Posts
    1k Views
    mrjjM
    Hi I do most layouts using Designer and loads mostly data from code. But you dont have to choose one way over the other. The UI forms is converted to code ( see setupUI() ) so sometimes i use Designer to create a layout/setup and then use the code from my code as templates. The main reason we like using UI files is that it allows the non UX developers to do a bit of GUI sometimes as its less involving to drag a new button to a layout than reading heaps of setup code to find right spot. But basically, its more a matter of taste than anything technical . But there are things you need to do from code as designer cannot do it.
  • 0 Votes
    3 Posts
    874 Views
    I
    This is a pretty old post, but I recently tried to tackle this and wanted to write down some of my findings about this obscure corner of Qt. It is probable that not all of this correct, this is just my current understanding. The purpose of QAbstractTextDocumentLayout::draw is to paint all of the relevant text blocks in the document (typically by means of delegating to QTextLayout::draw which does the actual heavy lifting) as well as any additional decorations and elements that surround the actual text objects (e.g. frame borders, list bullets, etc). It is also responsible for drawing the text cursor marker if needed. The layout class operates in document coordinates, so the position or size of the viewport of the actual widget (if it is even a widget, it could be drawing to a printer) is of no concern. The given QPainter is already pre-configured to accept the document's coordinate system. What defines what elements the view wants painted is the context.clip rectangle. At least those elements that intersect with it should be painted, so a straightforward thing to do would be to iterate over all blocks in the document, and check if their bounding rectangle intersects with the clip rectangle. Given that all blocks should already have their layout in place by the time draw is called, this is relatively fast. Of course this can be further optimized based on the layout class' knowledge of how blocks are laid out, for example a plain-text-like layout that arranges blocks linearly can use some sort of binary search. It is allowed to draw more than the clip, so drawing all blocks every time is a valid approach, although inefficient. It is also possible that the given clip rectangle is invalid, in which case everything needs to be drawn anyway. Though, I haven't seen QTextEdit not provide a valid clip. Other members of the PaintContext: palette - if you want to use the view's palette pens and brushes to paint something, they are available through here, although most colors will be determined by the character format. selections - for the text editing widgets, those are the "extra selections". For each painted block, you'll want to check if any of the extra selections' cursor is relevant to that block, turn it into block-relative start and end positions, and collect into a list that will be provided to QTextLayout::draw. cursorPosition - position in characters (relative to the document) where the text cursor marker should be drawn. Straightforward implementation would figure out the relevant block containing that position, and if relevant to the draw call, delegate to its' layout's QTextLayout::drawCursor method. You can also paint your own cursor directly with the painter if you'd like something custom. It is -1 if no cursor is required. One thing I noticed is that QTextEdit repeatedly calls draw on the text cursor's immediate area on a timer, alternating cursorPosition between -1 and the actual position, so that' how it makes a blinking cursor. There is also something with additional negative values, that seems related to pre-edit text, which is something I don't fully understand yet.
  • 0 Votes
    28 Posts
    17k Views
    Petross404_Petros SP
    @MCam Thank you, I was using plain adjustSize() that's why it didn't resize. Although there is problem that remains even when resizing both layouts : After unmaximising the window, adjustSize gives this result. I will mark the thread as solved because I can make the window to not be able to get maximized, but for completeness shake it would be nice if this result could be avoided. Either way, you saved my day and I thank you very much for that :)
  • 0 Votes
    12 Posts
    3k Views
    mrjjM
    Hi Not as far as i know. You can use the MS ActiveX if you want (MSHTML) http://doc.qt.io/qt-5/activeqt-activeqt-webbrowser-example.html and other techs on the other platforms.
  • 0 Votes
    2 Posts
    1k Views
    SGaistS
    Hi and welcome to devnet, You have to give more information about your setup. What device are you going to use ? What version of Qt ? What Linux distribution ? What graphical backend ?
  • Draw a widget on top af everything else

    Unsolved General and Desktop widgets layouts draw windowflags
    1
    0 Votes
    1 Posts
    877 Views
    No one has replied
  • Display QtWidget inside QML object

    Solved QML and Qt Quick qml widgets integration
    4
    0 Votes
    4 Posts
    1k Views
    M
    Ok thx guys, that was what I was worried about. I think I'll have to redo the design with a QML component though.
  • 0 Votes
    12 Posts
    5k Views
    R
    Try this , where you create ur control "dynamically" QLineEdit * m_edit=new QLineEdit(this); m_edit->setStyleSheet(":focus{background:white}"); /*this should set the stylesheet*/
  • 1 Votes
    6 Posts
    3k Views
    J
    I was having the same problem, but for me has worked to disable the Clang code model and restarting Qt.
  • Run Qt widget app on linux with no GUI

    Unsolved General and Desktop linux console widgets
    26
    0 Votes
    26 Posts
    24k Views
    mrjjM
    @Bremenpl Hi, other option is to create a custom session so you can have single app and also be able to start a desktop if needed. Most likely you will want to run a windows manager also. http://askubuntu.com/questions/23932/how-do-i-replace-the-desktop-by-an-application Im not sure if @Eeli-K solution is the same in debian version. :)
  • Displaying same widget on all windows.

    Unsolved General and Desktop qt 5.7 c++ windows widgets
    2
    0 Votes
    2 Posts
    1k Views
    Joel BodenmannJ
    Given that this question is C++ tagged: Usually you would create a class that does what you want and then you create multiple instances of that (or subclasses). For example, you crate the class MyWindow where you configure everything so it looks like you want (the menu bar, labels and so on) and then you just subclass that class to create your different windows - or, when you need the same window multiple times you just create instances directly. I'm not sure whether that helps you but your question is somewhat unspecific in my opinion.
  • 0 Votes
    2 Posts
    1k Views
    jerome_isAviableJ
    I think not. It seems to not deeply use the same "gstreamer plugins". I'm also not sure of my answer, but it is the impression i have. You can maybe try to change some camera parameters from qml code, but not sure you will have the same result (it's look like luminosity problem).
  • 0 Votes
    11 Posts
    6k Views
    kshegunovK
    @Chris-Kawa This is to ensure there's only one instance of it Ah, yes, I completely slept through this minor detail ... :$ Sure you could do something like this instead No thanks, I'll take your QPointer suggestion any day. The latter is ... well it's work-aroundishly ugly ... Sorry about that. Not at all, I agree with the "premature optimization is the root of all evil" stance I just didn't see the proximate cause for it here, that's all. ... hard to get wrong. This is what I always liked about the stack, as I'm lazy and don't like debugging bad code ... especially if it's mine ... ;)
  • 0 Votes
    3 Posts
    7k Views
    VRoninV
    if instead of checking the property you use the pseudo-state it should work qwidget->setStyleSheet( "QWidget:disabled{color: #64B2D1;}" "QWidget{color: blue;}");
  • 0 Votes
    5 Posts
    3k Views
    Q
    I had to add Q_OBJECT and also delete my debug folder once, to get rid of a few link errors. Also got rid of the QThread subclassing, it is way easier to create a worker class and connect it through signals. There is really a lot of outdated example code out there. Thanks for your help!
  • QtQuick w/o widgets

    Unsolved Qt Contribution quick widgets gerrit
    2
    0 Votes
    2 Posts
    2k Views
    SGaistS
    Hi, Since those are the same patches you should only target one branch. If it's the wrong one, don't worry it will be changed for you. In order to get them move forward, you should add reviewers that are concerned by your patches e.g. the module maintainers. One probable remark you will have is that your patch modifies several unrelated stuff so you should split them in order to ensure atomic changes e.g. one disables the item view part, another one the shortcut etc.
  • 0 Votes
    4 Posts
    2k Views
    SGaistS
    Qt's sources are covered by the same set of license, GPL, LGPL and Commercial. There's no one widget with a license and another with another license. You have to choose which license you want to use with your project and then abide by its rules. The commercial license being only available once you bought it.
  • 0 Votes
    8 Posts
    6k Views
    JonBJ
    @Elg1 I don't think anyone/the OP is around any longer to answer from a thread from 5 years ago! Suggest you open your own new thread question.
  • Qt Widgets Responsive yapmak

    Turkish responsive widgets qt creator
    3
    0 Votes
    3 Posts
    2k Views
    cemaldemir07C
    QML ile birlik oldukça etkili layoutlar, görseller tasarlayabiliyorsun. Qt ile yapılan uygulamalarda, Mesela ben Samsung Galaxy A5 ve Samsung t562 tablet üzerinde aynı kodları geliştirmeye çalışıyorum. Logicaldpi ile işlerimi halletmeye çalışıyorum ancak henüz halledemedim. Tam Olarak sorunu çözemedim. Yalnız Şu var; Fontlarda Hiç bir sıkıntı çıkmıyor. Font Büyüklükleri Güzel çıkıyor ancak Bir button koyduğumda güzel A5te bunu tablete açtığım neredeyse ekranın yarsını kapyalayacak. sebebibini bilemedim. Bazı Hatalar olduğunu düşünüyorum Qt ile Çok fazla Büyüdüğü için Muhtemelen ama Bi eşdeğeri henüz yok bu kütüphanenin. Bu Arada ingilizceyi biraz geliştirirsen sana çok faydası olur.