QCAD配置文件
位置位于:
C:\Users\{用户名}\AppData\Roaming\QCADQCAD3.ini
实际上是使用了QSettings
,可以存储一系列设置。每个设置包括指定设置名称(键)的一个字符串和一个与该键关联的·QVariant
存储数据。使用setValue()
可以实现一个设置。
配置多线程
[GraphicsView]
Multithreading=true
Threads=10
// enable multithreaded graphics view:
if (RSettings.getBoolValue("GraphicsView/Multithreading", true)) {
var numThreads = RSettings.getIntValue("GraphicsView/Threads", Math.max(RS.getIdealThreadCount(), 6));
if (numThreads!==1) {
this.graphicsView.setNumThreads(numThreads);
//EAction.handleUserMessage(qsTr("Threads:") + " " + numThreads);
}
}
int slice = int(floor(double(list.length())/painterThread.length()));
QList<QFuture<void> > futureThread;
for (int threadId=0; threadId<painterThread.length(); threadId++) {
int start = threadId*slice;
int end = (threadId+1)*slice;
if (threadId==painterThread.length()-1) {
end = list.length();
}
//qDebug() << "slice:" << start << end;
futureThread.append(QtConcurrent::run(this, &RGraphicsViewImage::paintEntitiesThread, threadId, list, start, end));
}
//RDebug::stopTimer(100, "launch threads");
//RDebug::startTimer(100);
for (int i=0; i<futureThread.length(); i++) {
futureThread[i].waitForFinished();
}
void RGraphicsViewImage::paintEntitiesThread(int threadId, QList<REntity::Id>& list, int start, int end) {
for (int i=start; i<end; i++) {
paintEntityThread(threadId, list[i]);
}
}
配置文字渲染
[TextRendering]
RenderAs=Paths
bool RSettings::isTextRenderedAsText() {
if (textRenderedAsText==-1) {
textRenderedAsText = getStringValue("TextRendering/RenderAs", "Text") == "Text";
}
return textRenderedAsText;
}
void RTextBasedEntity::exportEntity(RExporter& e, bool preview, bool forceSelected) const {
Q_UNUSED(preview)
// TODO: use transforms:
RTextBasedData data = getData();
if (e.isTextRenderedAsText()) {
// export text as text and return part that cannot be rendered as text as paths:
QList<RPainterPath> paths = e.exportText(data, forceSelected);
// export part of text that can only be rendered as painter paths (CAD fonts):
e.exportPainterPaths(paths, getPosition().z);
}
else {
e.exportPainterPathSource(data, getPosition().z);
}
}
原文链接:https://blog.csdn.net/mrbaolong/article/details/111997834