Comments (16)
It doesn't support RTF out of the box.
I tested this and it worked: https://stackoverflow.com/questions/1956542/how-to-make-item-view-render-rich-html-text-in-qt
If you need it, add the delegate to ui->history in lcUI/widgets/clicommand.cpp
from librecad_3.
I will try this.
from librecad_3.
By the way I could not achieve this. I was looking for such option so that when command line gives options to the user, it highlights using bold or underline font, the short cut options and the currently active option.
Example:
Options: < Radius >, Diameter
Is there already any function to do this?
from librecad_3.
Use this file for lcUI/widgets/clicommand.cpp: https://gist.github.com/feragon/0790b191c3cc400ba5c4ad2fba54d905
Try to enter some HTML command to test it (like <b>command</b>
)
from librecad_3.
Yes. It worked perfectly :-)
from librecad_3.
Couple of issues noticed.
-
Line spacing between messages has increased considerably. Tried doc.setDefaultStyleSheet but didn't work. Also tried doc.setDocumentMargin(0); but no sucess.
-
Scrollbar get added after few messages and it does not auto scroll. I guess this is because of increased line spacing only.
from librecad_3.
The auto scroll wasn't properly before. You have to scroll down one or two times to enable it.
Can you try to replace the HTMLDelegate sizeHint method with this :
QSize HTMLDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const {
QTextDocument doc;
doc.setHtml(option.text);
doc.setTextWidth(option.rect.width());
return {(int) doc.textWidth(), (int) doc.size().height()};
}
from librecad_3.
Before changing QSize HTMLDelegate::sizeHint
After changing QSize HTMLDelegate::sizeHint "Provide Center Point" is almost hidden because of overlap.
To reduce the line spacing I have tried
message("<b>CIRCLE</b><br>Provide Center Point:", self.target_widget)
from librecad_3.
Did you tried without the <br>
? You can call message
two times (one call per line)
I'll look at changing sizeHint method to support multi-lines items.
from librecad_3.
With out
with separate message
calls
from librecad_3.
I tried changing ui->history from QListWidget to QTextEdit in readonly mode and I think it works better. Scrollbar appears but it can be made to autoscroll to the last line. Also history need not be trimmed.
from librecad_3.
history = new QTextEdit(dockWidgetContents);
void CliCommand::write(const QString& message) {
ui->history->setHtml(ui->history->toHtml() + message);
ui->history->verticalScrollBar()->setValue(ui->history->verticalScrollBar()->maximum());
}
from librecad_3.
It looks exactly the same. Do you need the HTML delegate with the QTextEdit ?
You can use the QTextEdit, I don't see any problem with it.
from librecad_3.
No need for HTML delegate with QTextEdit, it can use toHtml()
from librecad_3.
Key Up and Key Down event for CliCommand::onKeyPressed(QKeyEvent *event)
not working.
It has a condition if(_historyIndex + 1 < _history.size())
but _historyIndex is always -1 and _history.size() is always 0
What is _historyIndex and _history.size() ? And why this condition?
from librecad_3.
The up and down keys allow to move into the last typed commands.
_history
should contains every typed command, and _historyIndex
is the current position in the history.
If _history.size()
is always 0, that means the commands are not added to the history anymore.
from librecad_3.
Related Issues (20)
- [openSUSE] How to compile LibreCAD3 with system installed tinyspline? HOT 3
- Dependency rapidjson should be added to build instructions HOT 9
- Is posible compile Librecad_3 using Mingw in Windows 10? HOT 4
- make -j 4 make: *** No targets specified and no makefile found. Stop. HOT 3
- Failed to build: error: no return statement in function returning non-void HOT 2
- Failed to build CMakeFiles/luacmdinterface.dir/main.cpp.o: in function CairoStore::image_create HOT 1
- Visual Programming for interconnect to others programs.
- DGN v7 file support HOT 1
- DimensionLinear Alignment
- LibreCAD3 works but it display some issues in terminal HOT 1
- ‘class tinyspline::BSpline’ has no member named ‘data’ HOT 2
- Segmentation fault in GL_Font::readyFont HOT 1
- why not libdxfrw as a git submodule? HOT 1
- Segmentation fault in lcunittest
- Can't open newly created 2D .dxf file HOT 1
- cmake is detecting lua 5.4 instead of 5.3 HOT 2
- LibreCAD_3 Whether you plan to support 3D? HOT 4
- Lua 5.3.6
- Define `main` branch as default instead of `master` HOT 2
- Status of the project HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from librecad_3.