当前位置: 首页 > news >正文

优秀企业网站seo从入门到精通

优秀企业网站,seo从入门到精通,wordpress在那个文件夹,app开发必须要网站吗QT图形视图系统 - 终篇 接上一篇#xff0c;我们需要继续完成以下的效果#xff1b; 先上个效果图#xff1a; 修改背景#xff0c;使之整体适配 上一篇我们绘制了标尺#xff0c;并且我们修改了放大缩小和对应的背景#xff0c;整体看来#xff0c;我们的滚动条会和…QT图形视图系统 - 终篇 接上一篇我们需要继续完成以下的效果 先上个效果图 修改背景使之整体适配 上一篇我们绘制了标尺并且我们修改了放大缩小和对应的背景整体看来我们的滚动条会和背景不搭配因此我们需要修改我们的背景这里使用qss修改;并且我们把之前的背景也写到这个里面。 style1.qss QGraphicsView {background: #000000; }QScrollBar:horizontal {border: none;background: #000000;height: 15px; } QScrollBar::handle:horizontal {background: white;min-width: 20px; } QScrollBar::add-line:horizontal {border: none;background: #000000;width: 0px; }QScrollBar::sub-line:horizontal {border: none;background: #000000;width: 0px;subcontrol-position: left;subcontrol-origin: margin; } /*QScrollBar:left-arrow:horizontal, QScrollBar::right-arrow:horizontal {*/ /* border: 2px solid grey;*/ /* width: 3px;*/ /* height: 3px;*/ /* background: white;*/ /*}*/QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal {background: none; }QScrollBar:vertical {border: none;background: #000000;width: 15px;border-bottom: 1px solid red; } QScrollBar::handle:vertical {background: white;min-height: 20px; } QScrollBar::add-line:vertical {border: none;background: #000000;height: 0px;subcontrol-position: bottom;subcontrol-origin: margin; }QScrollBar::sub-line:vertical {border: none;background: #000000;height: 0px;subcontrol-position: top;subcontrol-origin: margin; } QScrollBar:up-arrow:vertical, QScrollBar::down-arrow:vertical {border: 2px solid grey;width: 3px;height: 3px;background: white; }QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {background: none; } 然后我们加载这个qss即可 将之前设置qss的地方修改成读取这个文件 QFile file(:/resources/qss/style1.qss); file.open(QIODevice::ReadOnly); // 设置软件背景色 setStyleSheet(QString(file.readAll())); file.close();绘制对应刻度的线条 QGraphicsView有两个函数一个是绘制背景色一个是绘制前景色。我们的样条实际上绘制的是背景色因此我们需要重写这两个函数 void drawForeground(QPainter* painter, const QRectF rect) override; void drawBackground(QPainter* painter, const QRectF rect) override;去掉之前再scene中添加的文字我们接下来开始绘制 背景没有什么好说的直接绘制成黑色的就可以 void GraphicsView::drawBackground(QPainter *painter, const QRectF rect) {painter-fillRect(rect, Qt::black);// QGraphicsView::drawBackground(painter, rect); }接下来我们通过前景色来绘制刻度线 constexpr int32_t uScale 100000; constexpr double dScale 1.0 / uScale; static std::unordered_mapint, int gridLinesX, gridLinesY;void GraphicsView::drawForeground(QPainter *painter, const QRectF rect) {// fixme 这个地方需要修改成按照单位转换的double scale pow(10.0, ceil(log10(8.0 / h_ruler_-zoom())));double lineWidth {0};gridLinesX.clear(), gridLinesY.clear();const QColor color[4] {{255, 0, 0, 127}, // 0处使用红色绘制QColor(100, 100, 100, 50), // Grid1QColor(100, 100, 100, 150), // Grid5QColor(100, 100, 100, 255), // Grid10};double y, x;draw(scale * 0.1, rect, x, y);draw(scale * 0.5, rect, x, y);draw(scale * 1.0, rect, x, y);gridLinesX[0] 0;gridLinesY[0] 0;static QVectorQLineF lines[4];for (auto vec : lines)vec.clear();double tmp {};for (auto [x, colorIndex] : gridLinesX) {tmp x * dScale;lines[colorIndex].push_back(QLineF(tmp, rect.top(), tmp, rect.bottom()));}for (auto [y, colorIndex] : gridLinesY) {tmp y * dScale;lines[colorIndex].push_back(QLineF(rect.left(), tmp, rect.right(), tmp));}painter-save();painter-setRenderHint(QPainter::Antialiasing, false);int colorIndex {};for (auto vec : lines) {painter-setPen({color[colorIndex], lineWidth});painter-drawLines(vec.data(), vec.size());}auto width { rect.width() };auto height { rect.height() };painter-setPen({Qt::yellow, 0.0});painter-drawLine(QLineF {point_.x() - width, point_.y(), point_.x() width, point_.y()});painter-drawLine(QLineF {point_.x(), point_.y() - height, point_.x(), point_.y() height});painter-restore(); }void GraphicsView::draw(double sc, const QRectF rect, double x, double y) {if (sc 1.0) {int top floor(rect.top());int left floor(rect.left());y top - top % int(sc);x left - left % int(sc);} else {const double k 1.0 / sc;int top floor(rect.top()) * k;int left floor(rect.left()) * k;y (top - top % int(k)) / k;x (left - left % int(k)) / k;}for (const auto end_ rect.bottom(); y end_; y sc)gridLinesY[ceil(y * uScale)];for (const auto end_ rect.right(); x end_; x sc)gridLinesX[ceil(x * uScale)]; }这样我们便有了网格线 下面的函数是对ruler和鼠标移动时候的操作 void GraphicsView::updateRuler() {updateSceneRect(QRectF()); //QPoint p mapFromScene(QPointF());v_ruler_-setOrigin(p.y());h_ruler_-setOrigin(p.x());v_ruler_-setRulerZoom(qAbs(transform().m22() * 0.1));h_ruler_-setRulerZoom(qAbs(transform().m11() * 0.1));update(); }void GraphicsView::mouseMoveEvent(QMouseEvent *event) {QGraphicsView::mouseMoveEvent(event);v_ruler_-setCursorPos(event-pos());h_ruler_-setCursorPos(event-pos());point_ mapToScene(event-pos());emit sig_mouseMove(event-pos());update(); }我们之前对鼠标样式进行了修改这个里面也不要忘记将View中的鼠标修改成十字 展示的是主要代码并不是全部代码如果需要全部代码请联系博主获取
http://www.w-s-a.com/news/856003/

相关文章:

  • 建网站一般多少钱网站建设上传服务器步骤
  • 手机销售网站怎么做的网站推广优化建设方案
  • 做任务分享赚钱的网站德阳网站建设公司哪家好
  • 云南建设工程质量监督网站wordpress网站导航主题
  • 徐州网站建设哪家好薇手机开源网站代码
  • 更新网站要怎么做呢泰安市58同城招聘网
  • 溧阳网站建设价格企业网站设计费用
  • 我建设的网站打开很慢河北住房和城乡建设厅网站卡
  • 门户网站广告的特点有网站的建设初步定位
  • 建设网站第一步网页建设方案
  • 网站开发需要那些人才wordpress 小工具原理
  • 广州建设局官方网站佛山高端网站制作公司
  • 东莞哪里能学建设网站网站备案值得吗
  • 中山 网站建设 骏域小程序开发课程
  • 北京网站建设成都微商城app官方下载
  • 网站开发用户登陆的安全wordpress 开发网站
  • 网站建设容易出现的问题四川seo关键词工具
  • 做外单网站有哪些内容服务好的南京网站建设
  • 阜阳微商城网站建设百度网站两两学一做心得体会
  • 建设银行积分网站观光农业规划设计
  • jsp项目个人网站开发用织梦做网站有什么公司会要
  • 和田网站制作无限动力网站
  • 长沙口碑好网站建设企业网站 需求
  • 哪个网站建设公司wordpress陌陌主题
  • 湖滨区建设局网站北京国际建设集团网站
  • 做服装团购有哪些网站wordpress 端口修改
  • 上海礼品定制网站响应式网站模版建站
  • 那种自行提取卡密的网站怎么做网站攻击
  • 洛阳免费网站建设qq是哪家公司开发的软件
  • 怎么做网站网页wordpress网址导航