问题标签 [qtextbrowser]

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.

0 投票
1 回答
880 浏览

c++ - Qt TextBrowser 水平滚动条

每当调整应用程序的大小以使每一行都显示时,如何使水平滚动条出现?有时,文件名真的很长,我不想手动调整表单 UI 的大小。

我已尝试根据需要将滚动条策略设置为,但这无济于事。由于线条仍然出现在屏幕上。

在此处输入图像描述

增加表格尺寸:

在此处输入图像描述

0 投票
2 回答
1158 浏览

c++ - Qt 文本浏览器不实时显示

我编写了一个函数来计算一些值,并在每次计算值append时将它们写入。textBrowser

我想要的是每次append执行时,数据都会textBrowser同时显示。

但是,当函数结束时,所有数据都会立即显示。不一一。

另外,我有一个按钮。我希望它在推送时更改其文本,并在其功能完成时再次更改。所以我写道:

clicked但它只会在功能结束时将按钮的文本更改为“重置” 。

我认为这两个问题可能是相关的,但我找不到解决方案。

0 投票
1 回答
134 浏览

html - 显示图像的文本浏览器显示“QFSEngine::open: No file specified”警告

我正在使用 QTextBrowser 显示与应用程序位于同一目录中的外部 html 文档(及其图像资源)。相对路径根本不起作用,如果我输入图像的绝对文件路径,它显示正常,但在加载 html 文档之前会出现警告。警告说 "QFSEngine::open: No file specified" 。我正在使用这个片段加载我的 html 文件:

这是我的 html 文件:

我在阅读 html 时出错了,还是我必须在我的 cpp 文件中包含任何内容?

0 投票
1 回答
382 浏览

python - 在 QTextBrowser 中选择文本

我有一个QTextBrowser,当我选择里面的一部分文本时,我需要选择开始和结束的位置。我用mousePressEventand来做,mouseReleaseEvent它可以工作,但是高亮选择(深蓝色)没有出现。为什么?所以我看不到我选择了什么。

我尝试使用信号selectionChanged,但问题是每次选择文本时都会调用信号,而不是在释放鼠标和选择结束时调用。

有什么建议吗?

谢谢!

编辑:

这就像我想要的那样工作:

我需要点击的位置。这里:self.mousePress 和 self.mouseRelease。但是当我在 QTextBrowser 中选择文本时,突出显示不会出现。我希望我更清楚...

编辑2:

或这个:

0 投票
1 回答
1857 浏览

c++ - How do I remove the space between QPlainTextEdit and its contents

I'm using C++ and Qt on Windows to create a simple application which outputs some data to the screen using a QPlainTextEdit. The problem is that there is a small internal margin between the QPlainTextEdit's border and the text as shown here: http://i.stack.imgur.com/ovIrJ.png.
(The text in the QPlainTextEdit has been selected to highlight the gap)

I have tried using setContentsMargins(0, 0, 0, 0) and setStyleSheet("padding:0;"), and using a QTextEdit or a QTextBrowser instead, but I still get that small margin.

Googling it only turned up this unanswered question on qtcentre.org.

I know this is kind of a trivial thing but its really been annoying me for a while now.

Thanks in advance for any help!

0 投票
1 回答
426 浏览

c++ - 在布局中添加前进和后退按钮

我有一个水平布局,在其中添加了一个组框。分组框使用 a 拆分QSplitter并包含 aQListWidget和 a QTextBrowser。我想在窗口的右下角添加两个按钮以在QTextBrowser. 我在布局中添加了两个按钮,但无法在右下角添加它们。这是我的代码:

我已经尝试过拉伸因子来调整按钮以显示在拆分器的右下角。任何人都可以帮我吗?

0 投票
1 回答
1185 浏览

c++ - 更改 QTextBrowser 中的最后一行

我有一个QTextBrowser显示行QString和一个Int. 消息看起来像这样:

留言柜台1

留言柜台2

留言柜台 3

消息 b 计数器 1

而不是总是为计数器的每次增量添加一个新行,我只想增加Int最后一条消息(最后一行)中的 。最有效的方法是什么?

我想出了这段代码来只删除最后一行QTextBrowser

不幸的是,在删除最后一行看起来非常难看之后,这给我留下了一个空行。实现这一目标的最佳方法是什么,不涉及清除整个QTextBroswer并再次附加每一行。

0 投票
0 回答
567 浏览

c++ - Using QTextEdit and html to display formatted log-text

I need to display a large (and increasing) log-file with QTextEdit (alternatively with QTextBrowser, must be one of those 2, though) and format the output in 3 columns with following properties:

Is there somehow a way to use QTextEdit html markup (or something else, maybe) to achieve this and then simply append new log entries whenever necessary without recreating everything?

As a picture often says more than a thousand words I added an image of how I think it should look:

enter image description here

0 投票
0 回答
1244 浏览

pyqt - 将 sys.stdout 的输出通过管道传输到 pyqt 中的文本浏览器

我正在尝试将我的输出通过管道传输到 pyqt 的文本浏览器。现在我正在创建一个只有 write 方法的类。

那么就

这很好用,但有更好的方法吗?而且对于AttributeError: 'port' object has no attribute 'flush'我必须创建一个什么都不做的刷新方法,那么有没有更清洁的方法?

0 投票
1 回答
396 浏览

c++ - 当从 html 文件中读取 Unicode 内容时,为什么 Unicode 字体无法在 QTextBrowser 中正确显示?

我正在阅读一个html文件。该文件基本上包含Unicode文本,如下所示:

但是QTextBrowser没有解释Unicode字体。所以QTextBrowser显示它们如下:

QTextBrowser正确解释了html标签但是Unicode有什么问题字体有什么问题呢?

以下是我用于读取和填充 Unicode 内容的代码:

但是,如果我不从html文件中读取Unicode内容,而是直接将它们输入到参数中,那么它只会解释Unicode字体。例如,如果我这样做很好:

如何从html文件中读取Unicode内容并在QTextBrowser中显示它们?

如果有人向我展示我的代码中的错误部分或告诉我解决问题的更好方法,我将非常感激。