91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 1.56MB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2023-10-24
  • 語言: 其他
  • 標(biāo)簽: qtc++算法??

資源簡介

簡單的QT操作,包含了widget,socket,QTcpServer,pushbutton,等控件,是畢設(shè),項目的好幫手

資源截圖

代碼片段和文件信息

#include?“Board.h“
#include?
#include?
#include?
#define?GetRowCol(__row?__col?__id)?\
????int?__row?=?_s[__id]._row;\
????int?__col?=?_s[__id]._col
Board::Board(QWidget?*parent)?:?Qframe(parent)
{
????_r?=?20;
????setMinimumSize(_r*18+1?_r*20+1);//設(shè)置最小尺寸
????init(true);
}
void?Board::init(bool?bRedSide)
{
????for(int?i=0;?i<32;?++i)
????{
????????_s[i].init(i);
????}
????if(bRedSide)
????{
????????for(int?i=0;?i<32;?++i)
????????{
????????????_s[i].rotate();
????????}
????}

????_selectid?=?-1;
????_bRedTurn?=?true;
????_bSide?=?bRedSide;//估計是棋子的狀態(tài),是存在或是死亡
????update();
}

void?Board::paintEvent(QPaintEvent?*)
{
????//int?r?=?height()/20;//r是某個數(shù)值
????int?r?=20;//和上面那句的效果是一樣的
????_r?=?r;
????_off?=QPoint(r+1?r+1);//F1查閱QPoint,若00就會返回true

????QPainter?p(this);//構(gòu)建一個p的句柄
????p.setRenderHints(QPainter::Antialiasing?|?QPainter::TextAntialiasing);
//QPainter::Antialiasing表示如果可能的話,引擎應(yīng)該使用原語的別名。
????//
????p.save();//保存當(dāng)前的畫家狀態(tài)(將狀態(tài)推到堆棧上)。一個save()必須后面跟著一個相應(yīng)的恢復(fù)();end()函數(shù)解除堆棧。
????drawPlate(p);//繪制棋盤
????p.restore();

????p.save();//
????drawPlace(p);//畫了2個士的走線
????p.restore();//還原之前的設(shè)置

????p.save();
????drawInitPosition(p);//畫初始化位置的特殊花紋
????p.restore();

????p.save();
????drawStone(p);//畫象棋
????p.restore();
}

void?Board::drawStone(QPainter?&p)
{
????for(int?i=0;?i<32;?i++)
????{
????????drawStone(p?i);
????}
}

bool?Board::isDead(int?id)//id等于-1返回真?其余情況,返回棋子是否死亡的狀態(tài)
{
????if(id?==?-1)return?true;
????return?_s[id]._dead;
}

void?Board::drawStone(QPainter?&p?int?id)
{
????if(isDead(id))?return;

????QColor?color;
????if(red(id))?color?=?Qt::red;
????else?color?=?Qt::black;

????p.setPen(QPen(QBrush(color)?2));//設(shè)置畫筆的顏色和粗細(xì)

????if(id?==?_selectid)?p.setBrush(Qt::gray);//設(shè)置棋子被選中后,顯示的顏色
????else?p.setBrush(Qt::yellow);//設(shè)置棋子的填充色

????p.drawEllipse(cell(id));//繪制棋子的形狀,

????p.setFont(QFont(“system“?_r*1.2?700));//設(shè)置字體
????p.drawText(cell(id)?name(id)?QTextOption(Qt::AlignCenter));
}

QString?Board::name(int?id)
{
????return?_s[id].name();
}

bool?Board::red(int?id)
{
????return?_s[id]._red;
}

void?Board::drawInitPosition(QPainter?&p?int?row?int?col)//繪制了某個坐標(biāo)點上的一個花紋
{
????QPoint?pt?=?center(row?col);
????QPoint?off?=?QPoint(_r/6?_r/6);
????int?len?=?_r/3;

????QPoint?ptStart;
????QPoint?ptEnd;

????if(col?!=?0)
????{
????????/*?左上角?*/
????????ptStart?=?QPoint(pt.x()?-?off.x()?pt.y()?-?off.y());
????????ptEnd?=?ptStart?+?QPoint(-len?0);
????????p.drawLine(ptStart?ptEnd);
????????ptEnd?=?ptStart?+?QPoint(0?-len);
????????p.drawLine(ptStart?ptEnd);

????????/*?左下角?*/
????????ptStart?=?QPoint(pt.x()?-?off.x()?pt.y()?+?off.y());
????????ptEnd?=?ptStart?+?QPoint(-len?0);
????????p.drawLine(ptStart?ptEnd);
????????ptEnd?=?ptStart?+?QPoint(0?+len);
????????p.drawLine(ptStart?ptEnd);
????}

????if(col?!=?8)
????{
????????/*?右下角?*/
????????ptStart?=?QPoint(pt.x()?+?off.x()?pt.y()?+?

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-12-04?15:18??chessbymySelf\
?????目錄???????????0??2017-12-04?17:36??chessbymySelf\chess\
?????文件???????14089??2017-12-04?16:02??chessbymySelf\chess\Board.cpp
?????文件????????2735??2017-12-04?17:13??chessbymySelf\chess\Board.h
?????文件?????????926??2017-12-04?16:02??chessbymySelf\chess\Choosedlg.cpp
?????文件?????????372??2017-12-04?16:02??chessbymySelf\chess\Choosedlg.h
?????文件?????????579??2017-12-04?16:02??chessbymySelf\chess\Ctrlpanel.cpp
?????文件?????????336??2017-12-04?17:35??chessbymySelf\chess\Ctrlpanel.h
?????目錄???????????0??2017-12-04?17:34??chessbymySelf\chess\Debug\
?????文件?????????835??2017-12-04?17:34??chessbymySelf\chess\Debug\.qmake.stash
?????文件???????31793??2017-12-04?17:34??chessbymySelf\chess\Debug\Makefile
?????文件??????169960??2017-12-04?17:34??chessbymySelf\chess\Debug\Makefile.Debug
?????文件??????170188??2017-12-04?17:34??chessbymySelf\chess\Debug\Makefile.Release
?????目錄???????????0??2017-12-04?17:35??chessbymySelf\chess\Debug\debug\
?????文件??????201840??2017-12-04?17:35??chessbymySelf\chess\Debug\debug\Board.obj
?????文件??????111288??2017-12-04?17:34??chessbymySelf\chess\Debug\debug\Choosedlg.obj
?????文件???????98097??2017-12-04?17:35??chessbymySelf\chess\Debug\debug\Ctrlpanel.obj
?????文件??????114900??2017-12-04?17:35??chessbymySelf\chess\Debug\debug\Mainwnd.obj
?????文件???????89843??2017-12-04?17:35??chessbymySelf\chess\Debug\debug\Multigame.obj
?????文件??????134267??2017-12-04?17:35??chessbymySelf\chess\Debug\debug\Netgame.obj
?????文件??????143458??2017-12-04?17:35??chessbymySelf\chess\Debug\debug\Singlegame.obj
?????文件???????57153??2017-12-04?17:35??chessbymySelf\chess\Debug\debug\Step.obj
?????文件???????94960??2017-12-04?17:35??chessbymySelf\chess\Debug\debug\Stone.obj
?????文件??????167424??2017-12-04?17:36??chessbymySelf\chess\Debug\debug\chess.exe
?????文件?????1399456??2017-12-04?17:36??chessbymySelf\chess\Debug\debug\chess.ilk
?????文件?????2166784??2017-12-04?17:36??chessbymySelf\chess\Debug\debug\chess.pdb
?????文件?????1593344??2017-12-04?17:35??chessbymySelf\chess\Debug\debug\chess.vc.pdb
?????文件???????92382??2017-12-04?17:35??chessbymySelf\chess\Debug\debug\main.obj
?????文件????????3369??2017-12-04?17:35??chessbymySelf\chess\Debug\debug\moc_Board.cpp
?????文件???????71268??2017-12-04?17:35??chessbymySelf\chess\Debug\debug\moc_Board.obj
?????文件????????3467??2017-12-04?17:34??chessbymySelf\chess\Debug\debug\moc_Choosedlg.cpp
............此處省略30個文件信息

評論

共有 條評論

相關(guān)資源