问题标签 [qscrollarea]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
qt - Setting initial size of QTabWidget
I am creating a QTabWidget that has a number of tabs and each tab contains a different number of push buttons. Because some of these tabs may include many push buttons, I would like to make each tab scrollable.
I have an implementation that sort of works except no matter what I try I can't get the darn QTabWidget to be of a particular vertical size - it always wants to size itself based on the maximum height used by one of its pages. I've tried changing size policies, layout strategies and nothing works.
Here is exact widget structure I am using:
I populate the QTabWidget with QWidget instances that serve as pages. These instances are wrapped around with a QScrollArea and use a QGridLayout so that I can populate the tab with push buttons in a grid.
Here is the actual code that populates the tab widget:
BTW, I am using Qt 5.0.2 on Mac OS X 10.8.2.
qt - QScrollWidget 中的 QVBoxLayout 不更新大小
我有一个 QVBoxLayout 作为我的窗口中的指针,并且想要动态添加小部件(当用户按下按钮时,小部件被添加到 VBoxLayout)。VBoxLayout 设置为 ScrollArea 中的 Layout。但是如果我将小部件添加到 VBoxLayout,则 VBoxLayout 的大小不会改变,并且所有内容都会被弄皱。
addControl() Slot 只是添加了一个 Widget:
我想我必须告诉 QScrollArea 它应该更新它的高度。
c++ - QScrollArea 缺少滚动条
我认为这与以下问题相同:QScrollArea resizing QWidget
但没有解决方案。所以让我暴露这个问题。
- 测试 2 继承自 QWidget:
- 组成:
- QSpinBox 的向量
- QScrollArea
- QVBoxLayout
- test2 (QWidget) <- QScrollArea <- QVBoxLayout <- Spinbox
- 组成:
- 问题 :
- 没有滚动条
- [已修复] 滚动条的内部被缩小以适应如此小的空间,无法读取任何内容(窗口可以在执行期间调整大小,这将导致内部变大并且可读,但不会出现滚动条)
我认为问题来自单一来源:: Size Hints and Layouts ( http://qt-project.org/doc/qt-5.1/qtwidgets/qscrollarea.html#details )
第二个问题(小部件缩小)可以通过设置“c->setSizeConstraint(QLayout::SetMinimumSize);”来解决
我目前正在寻找缺少滚动条的解决方案
这是显示我的问题的代码:
编辑::在这里找到了一个解决方案:http: //qt-project.org/forums/viewthread/295
如果你不想在这里阅读大量无用的代码,他做了什么 :: 他扭曲了小部件内的布局
解决方案::从ScrollBar <- Widget <- Layout继承Object
而不是小部件 <- ScrollBar <- 布局
但它不是一个真正的解决方案......我将尝试我给出的例子。
有用。有没有人有更好的解决方案??
c++ - QScrollArea 中没有显示任何内容
我有一个不错的小部件,它基本上看起来像一个带有一堆 QSlider 的对话框。滑块的数量取决于调用对话框(不是实际的 QDialog;只是一个 QWidget)时的情况。
由于不同数量的滑块导致盒子在不同时间的大小不同,我现在想通过将滑块限制到 QScrollArea 来稍微清理一下。如果我理解正确,这样的滚动区域会显示许多滑块,但它的高度内适合多少滑块,如果有更多滑块,可以向下滚动以查看其余部分。
无论如何,我尝试了一个(有点复杂)这样的程序:
在自定义 QWidget 类的构造函数中(m_variableName = 成员变量):
在构造函数之后,会根据实际情况对滑块进行设置:
这个过程不会导致整个对话框中显示任何内容,除了左侧的固定滚动条。如果可能的话,使这项工作正常进行的初始化步骤的正确顺序是什么?我的猜测是我可能给了错误的父项或在错误的时间设置了布局,但是到目前为止我尝试过的重新排列都没有奏效......
c++ - 用 Qt 制作问卷,使用 QScrollArea
我正在尝试使用 Qt 制作问卷,使用 Qt Designer 来设计表单。
我想在一行上显示每个问题和可能的答案,一个问题在前一个问题下。问题是我有太多问题无法放在我的窗口中。
我尝试使用 qtscrollarea 但我无法获得滚动条....
我正在使用QtDesigner,我放了一个qtscrollarea,其中有一个垂直布局,在垂直布局中添加了包含问题和答案的QWidgets。我试图强制垂直布局大于qtscrollarea,尝试将somme Qwidget更改为水平布局,取消垂直布局......但仍然没有滚动条。
关于通过 QtDesigner 进行操作的任何建议?
qt - 添加到布局后,孤儿 QScrollArea 仍然存在
我在将 QScrollArea 添加到 QDialog 小部件中的布局时遇到问题。当我将滚动区域添加到布局中时,它会出现在我想要的位置,并带有我分配给它的小部件,并且它滚动得很好。但是,我的对话框左上角还留有一个空白滚动区域,就好像我根本没有将滚动区域添加到布局中一样!
为什么会这样?
qt - QDialog和滚动区域:如何合并它们?
从 ImageViewer 示例中:
我需要滚动区域不是出现在中央小部件中,而是出现在中央小部件内的对话框中。
我试过:
从这段代码中,我得到了中央小部件内的对话框。但是,此对话框不包含图像本身,而是包含图像的滚动区域。
我希望对话框和滚动区域是“同一件事”......
qt - 在 QScrollarea 中访问滚动条会导致运行时错误
QScrollAreas 有一些问题..
我希望能够动态启用/禁用滚动条,因此我尝试实现
这会导致应用程序以代码 255 终止并且不输出任何内容。注释掉这一行后输出很好。我可以用:
也没有问题。我尝试子类化自定义 QScrollArea 以查看是否可以让我修改 qscrollbar,但同样的问题。scrollArea 在 ui 表单上构建,并在自定义 displayWindow 类中重新设置父级。
有任何想法吗?
c++ - 无法让 QScrollArea 工作
我有一个QDeclarativeView
我想提出QScrollArea
的问题是滚动区域不起作用。我设置声明性视图有多大并不重要。我没有得到滚动条,就像它不能告诉视图需要滚动条一样。如果我不设置 setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); 滚动条不出现。
父级作为中央小部件插入到边框布局中 - 我使用此布局http://qt-project.org/doc/qt-4.8/layouts-borderlayout.html
这是我的小部件:
我在内容上尝试了不同的大小,但就像 qscrollview 没有检测到我的小部件何时大于 qscrollarea 的可见视图。
python - Generate PyQt Legend
I'm trying to build myself a simple graphics calculator, as a way of teaching myself PyQt. I'd like the calculator to have a pane which lists all of the equations plotted and shows the line style used.
I began with a QListWidget to achieve these ends, the pane contains a scrollable list of equations, but does not show the line style because the QListWidget only allows strings or icons.
So I tried using a QAbstractScrollArea widget instead. For each equation I use QHBoxLayout to produce two Widgets, a label containing the equation string, and a QWidget within which I draw the line style. Then I stack all of the equation QHBoxLayouts within the ScrollArea using QVBoxLayout.
The problem is that QVBoxLayout uses all of the space available to it. So if I have only three equations, they are spread throughout the pane and not listed at the top as I'd like them to be, while if I have too many equations to fit in the pane they are stacked on top of one another rather than causing the area to be scrollable.
This is how the calculator appears with too many equations...
And this is how it looks with too few...
Does anyone have any suggestions of better ways to get around these issues? One idea is to generate icons programmatically to have the properties of the lines and to use these in the listwidget, is that possible?