Commit c20e434d authored by Christoffer Ackelman's avatar Christoffer Ackelman Committed by Esteban Blanc

QT: Fixed drawing dotted lines.

parent 76ee5524
......@@ -1707,11 +1707,11 @@ GeQt::GeQt(void* x_parent_ctx, ldh_tSesContext x_ldhses, int x_exit_when_close,
// Line type option menu
QComboBox* tools_linetype
= addToolMenu(toplevel, tools3, SLOT(activate_linetype(int)));
for (int i = 1; i <= 7; i++) {
for (int i = 0; i < 7; i++) {
std::ostringstream txt;
txt << "Linetype " << i;
txt << "Linetype " << (i + 1);
std::ostringstream fname;
fname << "$pwr_exe/ge_linetype_" << i << ".png";
fname << "$pwr_exe/ge_linetype_" << (i + 1) << ".png";
tools_linetype->addItem(
get_icon(fname.str().c_str()), txt.str().c_str(), i);
}
......
......@@ -1079,7 +1079,8 @@ int GlowDrawQt::line_helper(GlowWind* wind, int painter_type, int size, int x1,
if (line_type != glow_eLineType_Solid) {
QPen pen = painter->pen();
pen.setWidth(size + 1);
pen.setStyle(Qt::DashLine);
pen.setStyle(Qt::CustomDashLine);
pen.setCapStyle(Qt::FlatCap);
pen.setJoinStyle(Qt::MiterJoin);
painter->setPen(pen);
QVector<double> dashes;
......@@ -1097,26 +1098,22 @@ int GlowDrawQt::line_helper(GlowWind* wind, int painter_type, int size, int x1,
break;
}
case glow_eLineType_Dotted: {
dashes << 1 + size << 1 + size;
dashes << 1 + 4 * size << 1 + 4 * size;
dashes << 1 + size << 1 + 4 * size;
break;
}
case glow_eLineType_DotDashed1: {
dashes << 1 + 3 * size << 1 + 3 * size;
dashes << 1 + 2 * size << 1 + 2 * size;
dashes << 1 + size << 1 + size;
dashes << 1 + 2 * size << 1 + 2 * size;
dashes << 1 + 3 * size << 1 + 2 * size << 1 + size << 1 + 2 * size;
break;
}
case glow_eLineType_DotDashed2: {
dashes << 1 + 6 * size << 1 + 6 * size;
dashes << 1 + 3 * size << 1 + 3 * size;
dashes << 1 + size << 1 + size;
dashes << 1 + 3 * size << 1 + 3 * size;
dashes << 1 + 6 * size << 1 + 3 * size << 1 + size << 1 + 3 * size;
break;
}
default:;
}
for (int i = 0; i < dashes.size(); i++) {
dashes[i] /= (1 + size);
}
pen.setDashPattern(dashes);
painter->setPen(pen);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment