我在QML中有一段代码:
Image {
anchors.rightMargin: 10
anchors.leftMargin: 10
anchors.bottomMargin: 10
anchors.topMargin: 10
anchors.fill: parent
source: "Google Chrome Icon.png"
fillMode: Image.PreserveAspectFit
}
Run Code Online (Sandbox Code Playgroud)
图像会随窗口自动拉伸.但拉伸方法没有抗锯齿,因此丑陋的结果:
chrome image http://img838.imageshack.us/img838/667/unantialiasedchrome.png
有没有什么方法可以让结果变得更好?
我的项目是创建一个小程序,演示搜索引擎的工作:索引和返回任意查询的结果.我已经完成了索引器部分的工作,现在我想通过一次索引多个文件来改进它.MainWindow类在这里:
class MainWindow : public QMainWindow
{
Q_OBJECT
.....
private:
Indexer * indexer;
QStringList fileList;
....
void index(QStringList list);
void add(const QString &filename);
}
Run Code Online (Sandbox Code Playgroud)
这是执行add(add需要访问fileList以避免再次索引相同的文件,因此它不能是静态方法):
void MainWindow::add(const QString &filename)
{
if (!fileList.contains(filename))
{
indexer->addDocument(filename.toStdString());
fileList.append(filename);
qDebug() << "Indexed" << filename;
emit updatedList(fileList);
}
}
Run Code Online (Sandbox Code Playgroud)
index方法的实现是接收文件列表并调用add每个文件名:
void MainWindow::index(QStringList list)
{
....
QtConcurrent::map(list, &MainWindow::add);
....
}
Run Code Online (Sandbox Code Playgroud)
我在编译这些代码时收到的错误是:
usr/include/qt4/QtCore/qtconcurrentmapkernel.h: In member function 'bool QtConcurrent::MapKernel<Iterator, MapFunctor>::runIteration(Iterator, int, void*) [with Iterator = QList<QString>::iterator, MapFunctor = QtConcurrent::MemberFunctionWrapper1<void, …Run Code Online (Sandbox Code Playgroud)